File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed
Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -121,8 +121,7 @@ def psisx(x, c):
121121 res = np .zeros (len (x ))
122122 mask = np .abs (x ) <= c
123123 res [mask ] = 1
124- res [~ mask ] = (c / np .abs (x ))[~ mask ]
125- res [~ np .isfinite (x )] = 0
124+ res [~ mask ] = c / np .abs (x [~ mask ])
126125 return res
127126
128127 # Run the iterative reweighting algorithm to compute M-estimator.
Original file line number Diff line number Diff line change 11import numpy as np
2+ import pytest
23
34from sklearn_extra .robust .mean_estimators import median_of_means , huber
45
@@ -21,3 +22,10 @@ def test_mom():
2122 sample_cor = sample
2223 sample_cor [:num_out ] = np .inf
2324 assert np .abs (median_of_means (sample_cor , num_out , rng )) < 2
25+
26+
27+ def test_huber ():
28+ X = np .hstack ([np .zeros (90 ), np .ones (10 )])
29+ with pytest .warns (None ) as record :
30+ huber (X )
31+ assert len (record ) == 0
You can’t perform that action at this time.
0 commit comments