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

Skip to content

Commit cde9b83

Browse files
add test
1 parent 26ef4d0 commit cde9b83

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

sklearn/feature_selection/tests/test_from_model.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,3 +198,14 @@ def test_threshold_without_refitting():
198198
# Set a higher threshold to filter out more features.
199199
model.threshold = "1.0 * mean"
200200
assert_greater(X_transform.shape[1], model.transform(data).shape[1])
201+
202+
203+
def test_transform_accepts_infinite_data():
204+
# Test that transform doesn't check for np.inf and np.nan values.
205+
est = RandomForestClassifier()
206+
model = SelectFromModel(estimator=est)
207+
model.fit(data, y)
208+
l = len(model.get_support())
209+
X = np.arange(l).reshape(1, l)
210+
X.fill(np.inf)
211+
model.transform(X)

0 commit comments

Comments
 (0)