PassiveAggressiveRegressor#
- class capymoa.regressor.PassiveAggressiveRegressor[source]#
Bases:
SKRegressor
Streaming Passive Aggressive regressor
This wraps sklearn.linear_model.PassiveAggressiveRegressor for ease of use in the streaming context. Some options are missing because they are not relevant in the streaming context.
Reference:
Example Usage:
>>> from capymoa.datasets import Fried >>> from capymoa.regressor import PassiveAggressiveRegressor >>> from capymoa.evaluation import prequential_evaluation >>> stream = Fried() >>> schema = stream.get_schema() >>> learner = PassiveAggressiveRegressor(schema) >>> results = prequential_evaluation(stream, learner, max_instances=1000) >>> results["cumulative"].rmse() 3.700...
- sklearner: PassiveAggressiveRegressor#
The underlying scikit-learn object. See: sklearn.linear_model.PassiveAggressiveRegressor
- __init__(
- schema: Schema,
- max_step_size: float = 1.0,
- fit_intercept: bool = True,
- loss: str = 'epsilon_insensitive',
- average: bool = False,
- random_seed=1,
Construct a passive aggressive regressor.
- Parameters:
schema – Stream schema
max_step_size – Maximum step size (regularization).
fit_intercept – Whether the intercept should be estimated or not. If False, the data is assumed to be already centered.
loss –
The loss function to be used:
"epsilon_insensitive"
: equivalent to PA-I in the reference paper."squared_epsilon_insensitive"
: equivalent to PA-II in the reference paper.
average – When set to True, computes the averaged SGD weights and stores the result in the
sklearner.coef_
attribute. If set to an int greater than 1, averaging will begin once the total number of samples seen reaches average. Soaverage=10
will begin averaging after seeing 10 samples.random_seed – Seed for the random number generator.
- train(instance: RegressionInstance)[source]#