def test_get_params(): clf1 = KNeighborsClassifier(n_neighbors=1) clf2 = RandomForestClassifier(random_state=1) clf3 = GaussianNB() lr = LogisticRegression() sclf = StackingClassifier(classifiers=[clf1, clf2, clf3], meta_classifier=lr) got = sorted(list({s.split('__')[0] for s in sclf.get_params().keys()})) expect = [ 'average_probas', 'classifiers', 'gaussiannb', 'kneighborsclassifier', 'meta-logisticregression', 'meta_classifier', 'randomforestclassifier', 'use_features_in_secondary', 'use_probas', 'verbose' ] assert got == expect, got
def test_get_params(): np.random.seed(123) clf1 = KNeighborsClassifier(n_neighbors=1) clf2 = RandomForestClassifier(n_estimators=10) clf3 = GaussianNB() lr = LogisticRegression(solver='liblinear', multi_class='ovr') sclf = StackingClassifier(classifiers=[clf1, clf2, clf3], meta_classifier=lr) got = sorted(list({s.split('__')[0] for s in sclf.get_params().keys()})) expect = [ 'average_probas', 'classifiers', 'drop_last_proba', 'gaussiannb', 'kneighborsclassifier', 'meta_classifier', 'randomforestclassifier', 'store_train_meta_features', 'use_clones', 'use_features_in_secondary', 'use_probas', 'verbose' ] assert got == expect, got
def test_get_params(): clf1 = KNeighborsClassifier(n_neighbors=1) clf2 = RandomForestClassifier(random_state=1) clf3 = GaussianNB() lr = LogisticRegression() sclf = StackingClassifier(classifiers=[clf1, clf2, clf3], meta_classifier=lr) got = sorted(list({s.split('__')[0] for s in sclf.get_params().keys()})) expect = ['average_probas', 'classifiers', 'gaussiannb', 'kneighborsclassifier', 'meta-logisticregression', 'meta_classifier', 'randomforestclassifier', 'store_train_meta_features', 'use_features_in_secondary', 'use_probas', 'verbose'] assert got == expect, got
def test_get_params(): np.random.seed(123) clf1 = KNeighborsClassifier(n_neighbors=1) clf2 = RandomForestClassifier(n_estimators=10) clf3 = GaussianNB() lr = LogisticRegression(solver='liblinear', multi_class='ovr') sclf = StackingClassifier(classifiers=[clf1, clf2, clf3], meta_classifier=lr) got = sorted(list({s.split('__')[0] for s in sclf.get_params().keys()})) expect = ['average_probas', 'classifiers', 'drop_last_proba', 'gaussiannb', 'kneighborsclassifier', 'meta_classifier', 'randomforestclassifier', 'store_train_meta_features', 'use_clones', 'use_features_in_secondary', 'use_probas', 'verbose'] assert got == expect, got