Sklearn API for Classification

Untitled

Common Methods

Untitled

Miscellaneous Methods

Untitled

Ridge Classifier

<aside> 💡 RidgeClassifier is a classifier variant of the Ridge regressor.

</aside>

Untitled

Training a least square classifier

Step 1: Instantiate a classification estimator without passing any arguments to it. This creates a ridge classifier object.

from sklearn.linear_model import RidgeClassifier
ridge_classifier = RidgeClassifier()

Step 2: Call fit method on ridge classifier object with training feature matrix and label vector as arguments. Note: The model is fitted using X_train and y_train.

# Model training with feature matrix X_train and
# label vector or matrix y_train
ridge_classifier.fit(X_train, y_train)

Setting regularisation rate

<aside> 💡 - Set alpha to float value.

</aside>

from sklearn.linear_model import RidgeClassifier
ridge_classifier = RidgeClassifier(alpha=0.001)