class sklearn.linear_model.PassiveAggressiveRegressor(C=1.0, fit_intercept=True, max_iter=None, tol=None, early_stopping=False, validation_fraction=0.1, n_iter_no_change=5, shuffle=True, verbose=0, loss=’epsilon_insensitive’, epsilon=0.1, random_state=None, warm_start=False, average=False, n_iter=None)
[source]
Passive Aggressive Regressor
Read more in the User Guide.
Parameters: 


Attributes: 

See also
Online PassiveAggressive Algorithms <http://jmlr.csail.mit.edu/papers/volume7/crammer06a/crammer06a.pdf> K. Crammer, O. Dekel, J. Keshat, S. ShalevShwartz, Y. Singer  JMLR (2006)
>>> from sklearn.linear_model import PassiveAggressiveRegressor >>> from sklearn.datasets import make_regression >>> >>> X, y = make_regression(n_features=4, random_state=0) >>> regr = PassiveAggressiveRegressor(max_iter=100, random_state=0) >>> regr.fit(X, y) PassiveAggressiveRegressor(C=1.0, average=False, early_stopping=False, epsilon=0.1, fit_intercept=True, loss='epsilon_insensitive', max_iter=100, n_iter=None, n_iter_no_change=5, random_state=0, shuffle=True, tol=None, validation_fraction=0.1, verbose=0, warm_start=False) >>> print(regr.coef_) [20.48736655 34.18818427 67.59122734 87.94731329] >>> print(regr.intercept_) [0.02306214] >>> print(regr.predict([[0, 0, 0, 0]])) [0.02306214]
densify ()  Convert coefficient matrix to dense array format. 
fit (X, y[, coef_init, intercept_init])  Fit linear model with Passive Aggressive algorithm. 
get_params ([deep])  Get parameters for this estimator. 
partial_fit (X, y)  Fit linear model with Passive Aggressive algorithm. 
predict (X)  Predict using the linear model 
score (X, y[, sample_weight])  Returns the coefficient of determination R^2 of the prediction. 
set_params (*args, **kwargs)  
sparsify ()  Convert coefficient matrix to sparse format. 
__init__(C=1.0, fit_intercept=True, max_iter=None, tol=None, early_stopping=False, validation_fraction=0.1, n_iter_no_change=5, shuffle=True, verbose=0, loss=’epsilon_insensitive’, epsilon=0.1, random_state=None, warm_start=False, average=False, n_iter=None)
[source]
densify()
[source]
Convert coefficient matrix to dense array format.
Converts the coef_
member (back) to a numpy.ndarray. This is the default format of coef_
and is required for fitting, so calling this method is only required on models that have previously been sparsified; otherwise, it is a noop.
Returns: 


fit(X, y, coef_init=None, intercept_init=None)
[source]
Fit linear model with Passive Aggressive algorithm.
Parameters: 


Returns: 

get_params(deep=True)
[source]
Get parameters for this estimator.
Parameters: 


Returns: 

partial_fit(X, y)
[source]
Fit linear model with Passive Aggressive algorithm.
Parameters: 


Returns: 

predict(X)
[source]
Predict using the linear model
Parameters: 


Returns: 

score(X, y, sample_weight=None)
[source]
Returns the coefficient of determination R^2 of the prediction.
The coefficient R^2 is defined as (1  u/v), where u is the residual sum of squares ((y_true  y_pred) ** 2).sum() and v is the total sum of squares ((y_true  y_true.mean()) ** 2).sum(). The best possible score is 1.0 and it can be negative (because the model can be arbitrarily worse). A constant model that always predicts the expected value of y, disregarding the input features, would get a R^2 score of 0.0.
Parameters: 


Returns: 

sparsify()
[source]
Convert coefficient matrix to sparse format.
Converts the coef_
member to a scipy.sparse matrix, which for L1regularized models can be much more memory and storageefficient than the usual numpy.ndarray representation.
The intercept_
member is not converted.
Returns: 


For nonsparse models, i.e. when there are not many zeros in coef_
, this may actually increase memory usage, so use this method with care. A rule of thumb is that the number of zero elements, which can be computed with (coef_ == 0).sum()
, must be more than 50% for this to provide significant benefits.
After calling this method, further fitting with the partial_fit method (if any) will not work until you call densify.
© 2007–2018 The scikitlearn developers
Licensed under the 3clause BSD License.
http://scikitlearn.org/stable/modules/generated/sklearn.linear_model.PassiveAggressiveRegressor.html