Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e209dfa

Browse files
add test nan
1 parent 2642357 commit e209dfa

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

sklearn/feature_selection/tests/test_from_model.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import numpy as np
22

3+
from sklearn.impute import SimpleImputer
34
from sklearn.utils.testing import assert_true
45
from sklearn.utils.testing import assert_false
56
from sklearn.utils.testing import assert_equal
@@ -202,8 +203,9 @@ def test_threshold_without_refitting():
202203

203204
def test_transform_accepts_infinite_data():
204205
# Test that transform doesn't check for np.inf and np.nan values.
205-
est = RandomForestClassifier()
206+
est = SimpleImputer(strategy='mean', missing_values='NaN')
206207
model = SelectFromModel(estimator=est)
208+
data.fill(np.nan)
207209
model.fit(data, y)
208210

209211
X_len = len(model.get_support())

0 commit comments

Comments
 (0)