Пример #1
0
def test_regression():
    print("Regression tests")
    name = "gaussian"
    print("Create default", name, "model")
    (model, f_test) = regression_model_default(H2OGradientBoostingEstimator,
                                               name)
    print("Create custom ", name, "model")
    (model2, f_test2) = regression_model_distribution(
        H2OGradientBoostingEstimator,
        upload_distribution(CustomDistributionGaussian, name))
    check_model_metrics(model, model2, name)
Пример #2
0
def test_regression():
    print("Regression tests")
    name = "gaussian"
    print("Create default", name, "model")
    (model, f_test) = regression_model_default(H2OGradientBoostingEstimator,
                                               name)
    print("Create custom ", name, "model")
    (model2, f_test2) = regression_model_distribution(
        H2OGradientBoostingEstimator,
        upload_distribution(CustomDistributionGaussian, name))

    check_model_metrics(model, model2, name)

    print(
        "Test scoring history is without deviance if custom distribution is set."
    )
    sh = model.scoring_history().columns
    shc = model2.scoring_history().columns
    assert "training_deviance" in sh and "training_deviance" not in shc
Пример #3
0
def test_worng_and_inherited_regression():
    print("Create default gaussian model")
    (model, f_test) = regression_model_default(H2OGradientBoostingEstimator,
                                               "gaussian")

    print("Create custom wrong gaussian model")
    (model2, f_test2) = regression_model_distribution(
        H2OGradientBoostingEstimator,
        upload_distribution(CustomDistributionGaussianWrong, "gaussian_w"))
    assert model.rmse(valid=False) != model2.rmse(valid=False), \
        "Training rmse is not different for default and custom gaussian model."
    assert model.rmse(valid=True) != model2.rmse(valid=True), \
        "Validation rmse is not different for default and custom gaussian model."

    print("Create custom gaussian model without inheritance")
    (model3, f_test3) = regression_model_distribution(
        H2OGradientBoostingEstimator,
        upload_distribution(CustomDistributionGaussianNoInh, "gaussian_ni"))
    check_model_metrics(model, model3, "gaussian_ni")