5.2.2.1.2. sklearn.linear_model.RidgeClassifierCV¶
- class sklearn.linear_model.RidgeClassifierCV(alphas=array([ 0.1, 1., 10. ]), fit_intercept=True, normalize=False, score_func=None, loss_func=None, cv=None)¶
Methods
decision_function(X) fit(X, y[, sample_weight, class_weight]) Fit the ridge classifier. predict(X) Predict target values according to the fitted model. score(X, y) Returns the coefficient of determination R^2 of the prediction. set_params(**params) Set the parameters of the estimator. - __init__(alphas=array([ 0.1, 1., 10. ]), fit_intercept=True, normalize=False, score_func=None, loss_func=None, cv=None)¶
- fit(X, y, sample_weight=1.0, class_weight=None)¶
Fit the ridge classifier.
Parameters : X : array-like, shape = [n_samples, n_features]
Training vectors, where n_samples is the number of samples and n_features is the number of features.
y : array-like, shape = [n_samples]
Target values.
class_weight : dict, optional
Weights associated with classes in the form {class_label : weight}. If not given, all classes are supposed to have weight one.
sample_weight : float or numpy array of shape [n_samples]
Sample weight
Returns : self : object
Returns self.
- predict(X)¶
Predict target values according to the fitted model.
Parameters : X : array-like, shape = [n_samples, n_features] Returns : y : array, shape = [n_samples]
- score(X, y)¶
Returns the coefficient of determination R^2 of the prediction.
The coefficient R^2 is defined as (1 - u/v), where u is the regression sum of squares ((y - y_pred) ** 2).sum() and v is the residual sum of squares ((y_true - y_true.mean()) ** 2).sum(). Best possible score is 1.0, lower values are worse.
Parameters : X : array-like, shape = [n_samples, n_features]
Training set.
y : array-like, shape = [n_samples]
Returns : z : float
- set_params(**params)¶
Set the parameters of the estimator.
The method works on simple estimators as well as on nested objects (such as pipelines). The former have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.
Returns : self :