예제 #1
0
def test_learner_cross_validate_LGBC():
    inputer = Inputers(description_filepath=
                       "../../descriptions/pre/inputers/pima-diabetes.yaml")
    dataset = inputer.transform()
    y = dataset[inputer.target].values
    X = dataset[dataset.columns.difference([inputer.target])]
    learner = Learners(
        description_filepath="../../descriptions/learners/LGBC.yaml")
    learner.train(X, y, checkpoint="pima_LGBMC.ckp")
    learner.cross_validate(
        X,
        y,
        cv_description_filepath=
        "../../descriptions/learners/Cross_validation_classification.yaml",
    )
    assert len(learner.evaluate(X, y).keys()) == 9
예제 #2
0
def test_learner_cross_validate_RFC_iris_multiclass_evaluate_AO():
    inputer = Inputers(
        description_filepath="../../descriptions/pre/inputers/iris.yaml")
    dataset = inputer.transform()
    y = dataset[inputer.target].values
    X = dataset[dataset.columns.difference([inputer.target])]
    learner = Learners(
        description_filepath="../../descriptions/learners/RFC.yaml")
    learner.train(X, y, checkpoint="iris)RC.ckp")
    learner.cross_validate(
        X,
        y,
        cv_description_filepath=
        "../../descriptions/learners/Cross_validation_classification.yaml",
    )

    assert learner.evaluate(X, y)["accuracy"] == 1.0
예제 #3
0
def test_learner_cross_validate_RFC_iris_milticlass_evaluate_test_accuracy():
    inputer = Inputers(
        description_filepath="../../descriptions/pre/inputers/iris.yaml")
    dataset = inputer.transform()
    y = dataset[inputer.target].values
    X = dataset[dataset.columns.difference([inputer.target])]
    learner = Learners(
        description_filepath="../../descriptions/learners/RFC.yaml")
    learner.train(X, y, checkpoint="pima_LGBMC.ckp")
    score = learner.cross_validate(
        X,
        y,
        cv_description_filepath=
        "../../descriptions/learners/Cross_validation_classification.yaml",
    )

    assert score["mean"]["test_accuracy"] >= 0.95