Skip to content

Commit 0a0b5d9

Browse files
ahojnnesogrisel
authored andcommitted
Make sure dimension is correct for all estimators
1 parent 28569ec commit 0a0b5d9

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

sklearn/linear_model/ransac.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,11 @@ def fit(self, X, y):
216216
continue
217217

218218
# residuals of all data for current random sample model
219-
residuals_subset = residual_metric(base_estimator.predict(X) - y)
219+
y_pred = base_estimator.predict(X)
220+
if y_pred.ndim == 1:
221+
y_pred = y_pred[:, None]
222+
223+
residuals_subset = residual_metric(y_pred - y)
220224

221225
# classify data into inliers and outliers
222226
inlier_mask_subset = residuals_subset < residual_threshold

0 commit comments

Comments
 (0)