Skip to content

SKL2RiverRegressor

Compatibility layer from scikit-learn to River for regression.

Parameters

  • estimator

    Typesklearn_base.BaseEstimator

    A scikit-learn transformer which has a partial_fit method.

Examples

from river import compat
from river import evaluate
from river import metrics
from river import preprocessing
from river import stream
from sklearn import linear_model
from sklearn import datasets

dataset = stream.iter_sklearn_dataset(
    dataset=datasets.load_diabetes(),
    shuffle=True,
    seed=42
)

scaler = preprocessing.StandardScaler()
sgd_reg = compat.convert_sklearn_to_river(linear_model.SGDRegressor())
model = scaler | sgd_reg

metric = metrics.MAE()

evaluate.progressive_val_score(dataset, model, metric)
MAE: 84.501421

Methods

learn_many
learn_one

Fits to a set of features x and a real-valued target y.

Parameters

  • x
  • y

Returns

self

predict_many
predict_one

Predict the output of features x.

Parameters

  • x

Returns

The prediction.