utils.wrappers.river#
This module contains River Model Wrappers to turn the output of river models into lists or arrays.
Classes
|
Wrapper that transforms a river.metrics.base.Metric into a loss function. |
|
Wrapper for river prediction functions. |
- class utils.wrappers.river.RiverMetricToLossFunction(river_metric, dict_input_metric=False)[source]#
Bases:
objectWrapper that transforms a river.metrics.base.Metric into a loss function.
This Wrapper turns metrics that expect a single value as predictions (e.g. river.metrics.MAE, or river.metrics.Accuracy) or metrics that expect a dictionary as predictions (e.g. river.metrics.CrossEntropy) into a similar interface.
- class utils.wrappers.river.RiverWrapper(prediction_function)[source]#
Bases:
WrapperWrapper for river prediction functions.
This wrapper turns any prediction function ouput into an iterable (list or np.ndarray) output.
Examples
Basic usage:
>>> from river.ensemble import AdaptiveRandomForestClassifier >>> model = AdaptiveRandomForestClassifier() >>> model_function = RiverWrapper(model.predict_one)
For classifiers returning probas:
>>> model_function = RiverWrapper(model.predict_proba_one)