Beispiel #1
0
def _make_predict_args(estimator, *args, **kwargs):
    if is_forecaster(estimator):
        fh = 1
        return (fh,)

    elif is_classifier(estimator):
        X, y = make_classification_problem(*args, **kwargs)
        return (X,)

    elif is_regressor(estimator):
        X, y = make_regression_problem(*args, **kwargs)
        return (X,)

    else:
        raise ValueError(f"Estimator type: {type(estimator)} not supported")
Beispiel #2
0
def _make_fit_args(estimator, random_state=None, **kwargs):
    if is_forecaster(estimator):
        y = make_forecasting_problem(random_state=random_state, **kwargs)
        fh = 1
        return y, fh

    elif is_classifier(estimator):
        return make_classification_problem(random_state=random_state, **kwargs)

    elif is_regressor(estimator):
        return make_regression_problem(random_state=random_state, **kwargs)

    elif is_series_as_features_transformer(estimator):
        return make_classification_problem(random_state=random_state, **kwargs)

    elif is_single_series_transformer(estimator):
        y = make_forecasting_problem(random_state=random_state, **kwargs)
        return (y,)

    else:
        raise ValueError(f"Estimator type: {type(estimator)} not supported")