diff --git a/sklearn/linear_model/_ransac.py b/sklearn/linear_model/_ransac.py index 40ebb3a08420f..a5511b49e1ba1 100644 --- a/sklearn/linear_model/_ransac.py +++ b/sklearn/linear_model/_ransac.py @@ -373,7 +373,8 @@ def fit(self, X, y, sample_weight=None): # residuals of all data for current random sample model y_pred = base_estimator.predict(X) - residuals_subset = loss_function(y, y_pred) + sample_weight = _check_sample_weight(sample_weight, X) + residuals_subset = loss_function(y, y_pred) * sample_weight # classify data into inliers and outliers inlier_mask_subset = residuals_subset < residual_threshold