python类make_pipeline()的实例源码

tests.py 文件源码 项目:scikit-rebate 作者: EpistasisLab 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def test_relieffpercent_pipeline():
    """Ensure that ReliefF with % neighbors works in a sklearn pipeline when it is parallelized"""
    np.random.seed(49082)

    clf = make_pipeline(ReliefF(n_features_to_select=2, n_neighbors=0.1, n_jobs=-1),
                        RandomForestClassifier(n_estimators=100, n_jobs=-1))

    assert np.mean(cross_val_score(clf, features, labels, cv=3)) > 0.7
tests.py 文件源码 项目:scikit-rebate 作者: EpistasisLab 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def test_relieffpercent_pipeline_parallel():
    """Ensure that ReliefF with % neighbors works in a sklearn pipeline where cross_val_score is parallelized"""
    np.random.seed(49082)

    clf = make_pipeline(ReliefF(n_features_to_select=2, n_neighbors=0.1),
                        RandomForestClassifier(n_estimators=100, n_jobs=-1))

    assert np.mean(cross_val_score(clf, features, labels, cv=3, n_jobs=-1)) > 0.7
tests.py 文件源码 项目:scikit-rebate 作者: EpistasisLab 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def test_surf_pipeline():
    """Ensure that SURF works in a sklearn pipeline when it is parallelized"""
    np.random.seed(240932)

    clf = make_pipeline(SURF(n_features_to_select=2, n_jobs=-1),
                        RandomForestClassifier(n_estimators=100, n_jobs=-1))

    assert np.mean(cross_val_score(clf, features, labels, cv=3)) > 0.7
tests.py 文件源码 项目:scikit-rebate 作者: EpistasisLab 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def test_surfstar_pipeline():
    """Ensure that SURF* works in a sklearn pipeline when it is parallelized"""
    np.random.seed(9238745)

    clf = make_pipeline(SURFstar(n_features_to_select=2, n_jobs=-1),
                        RandomForestClassifier(n_estimators=100, n_jobs=-1))

    assert np.mean(cross_val_score(clf, features, labels, cv=3)) > 0.7
tests.py 文件源码 项目:scikit-rebate 作者: EpistasisLab 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def test_surfstar_pipeline_parallel():
    """Ensure that SURF* works in a sklearn pipeline where cross_val_score is parallelized"""
    np.random.seed(9238745)

    clf = make_pipeline(SURFstar(n_features_to_select=2),
                        RandomForestClassifier(n_estimators=100, n_jobs=-1))

    assert np.mean(cross_val_score(clf, features, labels, cv=3, n_jobs=-1)) > 0.7
tests.py 文件源码 项目:scikit-rebate 作者: EpistasisLab 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def test_multisurf_pipeline():
    """Ensure that MultiSURF works in a sklearn pipeline when it is parallelized"""
    np.random.seed(320931)

    clf = make_pipeline(MultiSURF(n_features_to_select=2, n_jobs=-1),
                        RandomForestClassifier(n_estimators=100, n_jobs=-1))

    assert np.mean(cross_val_score(clf, features, labels, cv=3)) > 0.7
tests.py 文件源码 项目:scikit-rebate 作者: EpistasisLab 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def test_multisurf_pipeline_parallel():
    """Ensure that MultiSURF works in a sklearn pipeline where cross_val_score is parallelized"""
    np.random.seed(320931)

    clf = make_pipeline(MultiSURF(n_features_to_select=2),
                        RandomForestClassifier(n_estimators=100, n_jobs=-1))

    assert np.mean(cross_val_score(clf, features, labels, cv=3, n_jobs=-1)) > 0.7
tests.py 文件源码 项目:scikit-rebate 作者: EpistasisLab 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def test_multisurfstar_pipeline():
    """Ensure that MultiSURF* works in a sklearn pipeline when it is parallelized"""
    np.random.seed(320931)

    clf = make_pipeline(MultiSURFstar(n_features_to_select=2, n_jobs=-1),
                        RandomForestClassifier(n_estimators=100, n_jobs=-1))

    assert np.mean(cross_val_score(clf, features, labels, cv=3)) > 0.7
tests.py 文件源码 项目:scikit-rebate 作者: EpistasisLab 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def test_relieff_pipeline_cont_endpoint():
    """Ensure that ReliefF works in a sklearn pipeline with continuous endpoint data"""
    np.random.seed(49082)

    clf = make_pipeline(ReliefF(n_features_to_select=2, n_neighbors=100, n_jobs=-1),
                        RandomForestRegressor(n_estimators=100, n_jobs=-1))

    assert abs(np.mean(cross_val_score(clf, features_cont_endpoint, labels_cont_endpoint, cv=3))) < 0.5
tests.py 文件源码 项目:scikit-rebate 作者: EpistasisLab 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def test_relieff_pipeline_cont_endpoint():
    """Ensure that ReliefF with % neighbors works in a sklearn pipeline with continuous endpoint data"""
    np.random.seed(49082)

    clf = make_pipeline(ReliefF(n_features_to_select=2, n_neighbors=0.1, n_jobs=-1),
                        RandomForestRegressor(n_estimators=100, n_jobs=-1))

    assert abs(np.mean(cross_val_score(clf, features_cont_endpoint, labels_cont_endpoint, cv=3))) < 0.5
tests.py 文件源码 项目:scikit-rebate 作者: EpistasisLab 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def test_surf_pipeline_cont_endpoint():
    """Ensure that SURF works in a sklearn pipeline with continuous endpoint data"""
    np.random.seed(240932)

    clf = make_pipeline(SURF(n_features_to_select=2, n_jobs=-1),
                        RandomForestRegressor(n_estimators=100, n_jobs=-1))

    assert abs(np.mean(cross_val_score(clf, features_cont_endpoint, labels_cont_endpoint, cv=3))) < 0.5
tests.py 文件源码 项目:scikit-rebate 作者: EpistasisLab 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def test_surfstar_pipeline_cont_endpoint():
    """Ensure that SURF* works in a sklearn pipeline with continuous endpoint data"""
    np.random.seed(9238745)

    clf = make_pipeline(SURFstar(n_features_to_select=2, n_jobs=-1),
                        RandomForestRegressor(n_estimators=100, n_jobs=-1))

    assert abs(np.mean(cross_val_score(clf, features_cont_endpoint, labels_cont_endpoint, cv=3))) < 0.5
tests.py 文件源码 项目:scikit-rebate 作者: EpistasisLab 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def test_multisurf_pipeline_cont_endpoint():
    """Ensure that MultiSURF works in a sklearn pipeline with continuous endpoint data"""
    np.random.seed(320931)

    clf = make_pipeline(MultiSURF(n_features_to_select=2, n_jobs=-1),
                        RandomForestRegressor(n_estimators=100, n_jobs=-1))

    assert abs(np.mean(cross_val_score(clf, features_cont_endpoint, labels_cont_endpoint, cv=3))) < 0.5
tests.py 文件源码 项目:scikit-rebate 作者: EpistasisLab 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def test_relieff_pipeline_mixed_attributes():
    """Ensure that ReliefF works in a sklearn pipeline with mixed attributes"""
    np.random.seed(49082)

    clf = make_pipeline(ReliefF(n_features_to_select=2, n_neighbors=100, n_jobs=-1),
                        RandomForestClassifier(n_estimators=100, n_jobs=-1))

    assert np.mean(cross_val_score(clf, features_mixed_attributes, labels_mixed_attributes, cv=3)) > 0.7
tests.py 文件源码 项目:scikit-rebate 作者: EpistasisLab 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def test_relieffpercent_pipeline_mixed_attributes():
    """Ensure that ReliefF with % neighbors works in a sklearn pipeline with mixed attributes"""
    np.random.seed(49082)

    clf = make_pipeline(ReliefF(n_features_to_select=2, n_neighbors=0.1, n_jobs=-1),
                        RandomForestClassifier(n_estimators=100, n_jobs=-1))

    assert np.mean(cross_val_score(clf, features_mixed_attributes, labels_mixed_attributes, cv=3)) > 0.7
tests.py 文件源码 项目:scikit-rebate 作者: EpistasisLab 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def test_surf_pipeline_mixed_attributes():
    """Ensure that SURF works in a sklearn pipeline with mixed attributes"""
    np.random.seed(240932)

    clf = make_pipeline(SURF(n_features_to_select=2, n_jobs=-1),
                        RandomForestClassifier(n_estimators=100, n_jobs=-1))

    assert np.mean(cross_val_score(clf, features_mixed_attributes, labels_mixed_attributes, cv=3)) > 0.7
tests.py 文件源码 项目:scikit-rebate 作者: EpistasisLab 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def test_surfstar_pipeline_mixed_attributes():
    """Ensure that SURF* works in a sklearn pipeline with mixed attributes"""
    np.random.seed(9238745)

    clf = make_pipeline(SURFstar(n_features_to_select=2, n_jobs=-1),
                        RandomForestClassifier(n_estimators=100, n_jobs=-1))

    assert np.mean(cross_val_score(clf, features_mixed_attributes, labels_mixed_attributes, cv=3)) > 0.7
tests.py 文件源码 项目:scikit-rebate 作者: EpistasisLab 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def test_multisurf_pipeline_mixed_attributes():
    """Ensure that MultiSURF works in a sklearn pipeline with mixed attributes"""
    np.random.seed(320931)

    clf = make_pipeline(MultiSURF(n_features_to_select=2, n_jobs=-1),
                        RandomForestClassifier(n_estimators=100, n_jobs=-1))

    assert np.mean(cross_val_score(clf, features_mixed_attributes, labels_mixed_attributes, cv=3)) > 0.7
tests.py 文件源码 项目:scikit-rebate 作者: EpistasisLab 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def test_relieff_pipeline_missing_values():
    """Ensure that ReliefF works in a sklearn pipeline with missing values"""
    np.random.seed(49082)

    clf = make_pipeline(ReliefF(n_features_to_select=2, n_neighbors=100, n_jobs=-1),
                        Imputer(),
                        RandomForestClassifier(n_estimators=100, n_jobs=-1))

    assert np.mean(cross_val_score(clf, features_missing_values, labels_missing_values, cv=3)) > 0.7
tests.py 文件源码 项目:scikit-rebate 作者: EpistasisLab 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def test_relieffpercent_pipeline_missing_values():
    """Ensure that ReliefF with % neighbors works in a sklearn pipeline with missing values"""
    np.random.seed(49082)

    clf = make_pipeline(ReliefF(n_features_to_select=2, n_neighbors=0.1, n_jobs=-1),
                        Imputer(),
                        RandomForestClassifier(n_estimators=100, n_jobs=-1))

    assert np.mean(cross_val_score(clf, features_missing_values, labels_missing_values, cv=3)) > 0.7


问题


面经


文章

微信
公众号

扫码关注公众号