sklearn.base.ClassifierMixin

class sklearn.base.ClassifierMixin[source]

Mixin class for all classifiers in scikit-learn.

Methods

score(self, X, y[, sample_weight])

Return the mean accuracy on the given test data and labels.

__init__(self, /, *args, **kwargs)

Initialize self. See help(type(self)) for accurate signature.

score(self, X, y, sample_weight=None)[source]

Return the mean accuracy on the given test data and labels.

In multi-label classification, this is the subset accuracy which is a harsh metric since you require for each sample that each label set be correctly predicted.

Parameters
Xarray-like of shape (n_samples, n_features)

Test samples.

yarray-like of shape (n_samples,) or (n_samples, n_outputs)

True labels for X.

sample_weightarray-like of shape (n_samples,), default=None

Sample weights.

Returns
scorefloat

Mean accuracy of self.predict(X) wrt. y.