Module Import alias identifier Import alias identifier ImportFrom alias alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias alias alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias Assign NameStore Call AttributeLoad NameLoad attr Assign TupleStore NameStore NameStore TupleLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Num FunctionDef arguments args defaults body For NameStore TupleLoad Call NameLoad keyword Num Call NameLoad keyword Num keyword NameLoad Call NameLoad keyword Num keyword Num keyword NameLoad keyword Num body For NameStore TupleLoad NameLoad Str Str body For NameStore TupleLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr body Assign NameStore Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr keyword Str Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Assign NameStore Call NameLoad NameLoad AttributeLoad NameLoad attr NameLoad NameLoad If Call NameLoad NameLoad NameLoad body Expr Call NameLoad CompareLtE SubscriptLoad AttributeLoad NameLoad attr Index Num SubscriptLoad AttributeLoad NameLoad attr Index Num orelse Expr Call NameLoad SubscriptLoad AttributeLoad NameLoad attr Index Num SubscriptLoad AttributeLoad NameLoad attr Index Num Expr Call AttributeLoad NameLoad attr keyword Str Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Expr Call NameLoad Call AttributeLoad NameLoad attr CompareEq NameLoad NameLoad Num decorator_list FunctionDef arguments args defaults body Assign NameStore Call NameLoad keyword Num keyword Num keyword NameLoad keyword NameLoad For NameStore ListLoad Str Str body Assign NameStore Call NameLoad NameLoad keyword NameLoad Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Expr Call NameLoad NameLoad AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args defaults body Expr Str Assign NameStore Call NameLoad Assign NameStore Call NameLoad keyword NameLoad Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Expr Call NameLoad CompareIs AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args defaults body Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr keyword Num keyword Num keyword Num keyword Num keyword Num keyword NameLoad keyword Num Assign NameStore Call NameLoad keyword Num keyword Num For TupleStore NameStore NameStore Call NameLoad ListLoad Str Str ListLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr body Assign NameStore Call NameLoad keyword NameLoad keyword NameLoad Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Expr Call NameLoad Call NameLoad AttributeLoad NameLoad attr Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad Expr Call NameLoad SubscriptLoad AttributeLoad NameLoad attr Index Num SubscriptLoad AttributeLoad NameLoad attr Index Num Assign NameStore AttributeLoad AttributeLoad NameLoad attr attr Assign NameStore CompareGt Call AttributeLoad NameLoad attr NameLoad Call NameLoad NameLoad Expr Call NameLoad NameLoad SubscriptLoad NameLoad ExtSlice Slice Index NameLoad Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr AugAssignMult SubscriptStore NameLoad Index CompareEq NameLoad Num Num Assign NameStore Call NameLoad keyword Num keyword Num Assign NameStore Call NameLoad keyword NameLoad Expr Call AttributeLoad NameLoad attr NameLoad NameLoad keyword NameLoad Assign NameStore AttributeLoad AttributeLoad NameLoad attr attr Expr Call AttributeLoad NameLoad attr NameLoad NameLoad keyword BinOpMult Num NameLoad Assign NameStore AttributeLoad AttributeLoad NameLoad attr attr Expr Call NameLoad NameLoad NameLoad Assign NameStore Call NameLoad keyword Call NameLoad keyword Num Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore CompareGt Call AttributeLoad NameLoad attr AttributeLoad AttributeLoad NameLoad attr attr Num Expr Call NameLoad NameLoad SubscriptLoad NameLoad ExtSlice Slice Index NameLoad decorator_list NameLoad FunctionDef arguments args defaults body Assign NameStore Call NameLoad keyword Num keyword NameLoad Assign NameStore Call NameLoad keyword NameLoad Expr Call AttributeLoad NameLoad attr NameLoad NameLoad keyword Call AttributeLoad NameLoad attr NameLoad Assign NameStore AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr NameLoad NameLoad keyword Call AttributeLoad NameLoad attr NameLoad Assign NameStore AttributeLoad NameLoad attr Expr Call NameLoad CompareIs NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr TupleLoad NameLoad NameLoad Call AttributeLoad NameLoad attr TupleLoad NameLoad NameLoad Expr Call NameLoad NameLoad Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args defaults body Assign NameStore Call NameLoad keyword NameLoad keyword Num Assign NameStore Call NameLoad keyword NameLoad Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Assign NameStore AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Assign NameStore AttributeLoad NameLoad attr Expr Call NameLoad CompareIs NameLoad NameLoad decorator_list FunctionDef arguments args defaults body Expr Str Assign NameStore Call NameLoad keyword Num keyword Num keyword NameLoad keyword Num Assign NameStore Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Assign NameStore Call NameLoad NameLoad keyword NameLoad Expr Call NameLoad Call AttributeLoad NameLoad attr NameLoad NameLoad Assign NameStore Call NameLoad NameLoad keyword NameLoad Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Expr Call NameLoad Call AttributeLoad NameLoad attr NameLoad NameLoad Assign NameStore Call NameLoad NameLoad keyword NameLoad Expr Call NameLoad NameLoad AttributeLoad NameLoad attr NameLoad NameLoad decorator_list FunctionDef arguments args defaults body Assign NameStore Call NameLoad keyword Num keyword Num Assign NameStore Call NameLoad NameLoad keyword Str Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Assign NameStore BinOpMult Num Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign NameStore CompareGt AttributeLoad NameLoad attr NameLoad Expr Call NameLoad NameLoad SubscriptLoad NameLoad ExtSlice Slice Index NameLoad decorator_list FunctionDef arguments args defaults body Expr Str Assign NameStore Call NameLoad keyword Num keyword Num keyword NameLoad keyword Num Assign NameStore Call NameLoad NameLoad keyword Num Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign AttributeStore NameLoad attr Num Expr Call NameLoad SubscriptLoad AttributeLoad NameLoad attr Index Num SubscriptLoad AttributeLoad Call AttributeLoad NameLoad attr NameLoad attr Index Num decorator_list
N/A N/A numpy np N/A scipy.sparse sp nose.tools assert_raises assert_true sklearn.utils.testing assert_less sklearn.utils.testing assert_greater sklearn.utils.testing assert_array_almost_equal sklearn.utils.testing assert_array_equal sklearn.utils.testing assert_almost_equal sklearn.utils.testing assert_warns sklearn.utils.testing skip_if_32bit sklearn datasets sklearn.linear_model LogisticRegression SGDClassifier Lasso sklearn.svm LinearSVC sklearn.feature_selection SelectFromModel sklearn.ensemble RandomForestClassifier sklearn.linear_model PassiveAggressiveClassifier N/A iris N/A N/A datasets load_iris N/A N/A data y N/A N/A iris data N/A iris target N/A rng N/A N/A N/A np random RandomState 0 test_transform_linear_model N/A N/A N/A N/A N/A clf N/A N/A LogisticRegression C 0.1 N/A LinearSVC C 0.01 dual False N/A SGDClassifier alpha 0.001 n_iter 50 shuffle True random_state 0 N/A N/A thresh N/A None .09*mean 1e-5 * median N/A N/A func N/A N/A np array N/A sp csr_matrix N/A N/A X N/A func data N/A N/A N/A clf set_params penalty l1 N/A N/A N/A clf fit X y N/A X_new N/A assert_warns DeprecationWarning N/A clf transform X thresh N/A N/A isinstance clf SGDClassifier N/A N/A N/A assert_true N/A N/A N/A X_new shape N/A 1 N/A N/A X shape N/A 1 N/A N/A N/A assert_less N/A N/A X_new shape N/A 1 N/A N/A X shape N/A 1 N/A N/A N/A clf set_params penalty l2 N/A N/A N/A clf fit X_new y N/A pred N/A N/A clf predict X_new N/A N/A assert_greater N/A N/A np mean N/A pred y 0.7 N/A test_invalid_input N/A N/A N/A N/A N/A clf N/A SGDClassifier alpha 0.1 n_iter 10 shuffle True random_state None N/A threshold N/A gobbledigook .5 * gobbledigook N/A N/A model N/A SelectFromModel clf threshold threshold N/A N/A N/A model fit data y N/A N/A assert_raises ValueError N/A model transform data N/A test_input_estimator_unchanged N/A N/A N/A N/A N/A 
    Test that SelectFromModel fits on a clone of the estimator.
     N/A est N/A RandomForestClassifier N/A transformer N/A SelectFromModel estimator est N/A N/A N/A transformer fit data y N/A N/A assert_true N/A N/A transformer estimator est N/A test_feature_importances N/A N/A N/A N/A N/A N/A X y N/A N/A datasets make_classification n_samples 1000 n_features 10 n_informative 3 n_redundant 0 n_repeated 0 shuffle False random_state 0 N/A est N/A RandomForestClassifier n_estimators 50 random_state 0 N/A N/A threshold func N/A zip N/A mean median N/A N/A np mean N/A np median N/A N/A transformer N/A SelectFromModel estimator est threshold threshold N/A N/A N/A transformer fit X y N/A N/A assert_true N/A hasattr N/A transformer estimator_ feature_importances_ N/A X_new N/A N/A transformer transform X N/A N/A assert_less N/A N/A X_new shape N/A 1 N/A N/A X shape N/A 1 N/A importances N/A N/A transformer estimator_ feature_importances_ N/A feature_mask N/A N/A N/A np abs importances N/A func importances N/A N/A assert_array_almost_equal X_new N/A X N/A N/A N/A feature_mask N/A sample_weight N/A N/A np ones N/A y shape N/A N/A sample_weight N/A N/A y 1 100 N/A est N/A RandomForestClassifier n_estimators 50 random_state 0 N/A transformer N/A SelectFromModel estimator est N/A N/A N/A transformer fit X y sample_weight sample_weight N/A importances N/A N/A transformer estimator_ feature_importances_ N/A N/A N/A transformer fit X y sample_weight N/A 3 sample_weight N/A importances_bis N/A N/A transformer estimator_ feature_importances_ N/A N/A assert_almost_equal importances importances_bis N/A transformer N/A SelectFromModel estimator N/A Lasso alpha 0.1 N/A N/A N/A transformer fit X y N/A X_new N/A N/A transformer transform X N/A mask N/A N/A N/A np abs N/A N/A transformer estimator_ coef_ 1e-05 N/A N/A assert_array_equal X_new N/A X N/A N/A N/A mask N/A skip_if_32bit test_partial_fit N/A N/A N/A N/A N/A est N/A PassiveAggressiveClassifier random_state 0 shuffle False N/A transformer N/A SelectFromModel estimator est N/A N/A N/A transformer partial_fit data y classes N/A N/A np unique y N/A old_model N/A transformer estimator_ N/A N/A N/A transformer partial_fit data y classes N/A N/A np unique y N/A new_model N/A transformer estimator_ N/A N/A assert_true N/A old_model new_model N/A X_transform N/A N/A transformer transform data N/A N/A N/A transformer fit N/A N/A np vstack N/A data data N/A N/A np concatenate N/A y y N/A N/A assert_array_equal X_transform N/A N/A transformer transform data N/A test_warm_start N/A N/A N/A N/A N/A est N/A PassiveAggressiveClassifier warm_start True random_state 0 N/A transformer N/A SelectFromModel estimator est N/A N/A N/A transformer fit data y N/A old_model N/A transformer estimator_ N/A N/A N/A transformer fit data y N/A new_model N/A transformer estimator_ N/A N/A assert_true N/A old_model new_model N/A test_prefit N/A N/A N/A N/A N/A 
    Test all possible combinations of the prefit parameter.
     N/A clf N/A SGDClassifier alpha 0.1 n_iter 10 shuffle True random_state 0 N/A model N/A SelectFromModel clf N/A N/A N/A model fit data y N/A X_transform N/A N/A model transform data N/A N/A N/A clf fit data y N/A model N/A SelectFromModel clf prefit True N/A N/A assert_array_equal N/A N/A model transform data X_transform N/A model N/A SelectFromModel clf prefit False N/A N/A N/A model fit data y N/A N/A assert_array_equal N/A N/A model transform data X_transform N/A model N/A SelectFromModel clf prefit True N/A N/A assert_raises ValueError N/A model fit data y N/A test_threshold_string N/A N/A N/A N/A N/A est N/A RandomForestClassifier n_estimators 50 random_state 0 N/A model N/A SelectFromModel est threshold 0.5*mean N/A N/A N/A model fit data y N/A X_transform N/A N/A model transform data N/A N/A N/A est fit data y N/A threshold N/A 0.5 N/A N/A np mean N/A est feature_importances_ N/A mask N/A N/A est feature_importances_ threshold N/A N/A assert_array_equal X_transform N/A data N/A N/A N/A mask N/A test_threshold_without_refitting N/A N/A N/A N/A N/A Test that the threshold can be set without refitting the model. N/A clf N/A SGDClassifier alpha 0.1 n_iter 10 shuffle True random_state 0 N/A model N/A SelectFromModel clf threshold 0.1 N/A N/A N/A model fit data y N/A X_transform N/A N/A model transform data N/A N/A model threshold 1.0 N/A N/A assert_greater N/A N/A X_transform shape N/A 1 N/A N/A N/A N/A model transform data shape N/A 1 N/A