PARegressor¶
Passive-aggressive learning for regression.
Parameters¶
-
C
Default →
1.0
-
mode
Default →
1
-
eps
Default →
0.1
-
learn_intercept
Default →
True
Examples¶
The following example is taken from this blog post.
from river import linear_model
from river import metrics
from river import stream
import numpy as np
from sklearn import datasets
np.random.seed(1000)
X, y = datasets.make_regression(n_samples=500, n_features=4)
model = linear_model.PARegressor(
C=0.01,
mode=2,
eps=0.1,
learn_intercept=False
)
metric = metrics.MAE() + metrics.MSE()
for xi, yi in stream.iter_array(X, y):
y_pred = model.predict_one(xi)
model.learn_one(xi, yi)
metric.update(yi, y_pred)
print(metric)
MAE: 9.809402
MSE: 472.393532
Methods¶
learn_one
Fits to a set of features x
and a real-valued target y
.
Parameters
- x
- y
predict_one
Predict the output of features x
.
Parameters
- x
Returns
The prediction.