def test_huber_scaling_invariant():
 rng = np.random.RandomState(0)
 (X, y) = make_regression_with_outliers()
 huber = HuberRegressor(fit_intercept=False, alpha=0.0, max_iter=100)
 huber.fit(X, y)
 n_outliers_mask_1 = huber.outliers_
 assert_false(np.all(n_outliers_mask_1))
 huber.fit(X, (2.0 * y))
 n_outliers_mask_2 = huber.outliers_
 assert_array_equal(n_outliers_mask_2, n_outliers_mask_1)
 huber.fit((2.0 * X), (2.0 * y))
 n_outliers_mask_3 = huber.outliers_
 assert_array_equal(n_outliers_mask_3, n_outliers_mask_1)

def test_huber_scaling_invariant ( ) : rng = np . random . RandomState ( 0 ) ( X , y ) = make_regression_with_outliers ( ) huber = HuberRegressor ( fit_intercept = False , alpha = 0.0 , max_iter = 100 ) huber . fit ( X , y ) n_outliers_mask_1 = huber . outliers_ assert_false ( np . all ( n_outliers_mask_1 ) ) huber . fit ( X , ( 2.0 * y ) ) n_outliers_mask_2 = huber . outliers_ assert_array_equal ( n_outliers_mask_2 , n_outliers_mask_1 ) huber . fit ( ( 2.0 * X ) , ( 2.0 * y ) ) n_outliers_mask_3 = huber . outliers_ assert_array_equal ( n_outliers_mask_3 , n_outliers_mask_1 )
test that outliers filtering is scaling independent .