sklearn.base.ClassifierMixin

class sklearn.base.ClassifierMixin[源代码]

Mixin class for all classifiers in scikit-learn.

Methods

score(X, y[, sample_weight]) Returns the mean accuracy on the given test data and labels.
__init__()

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

score(X, y, sample_weight=None)[源代码]

Returns 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:

X : array-like, shape = (n_samples, n_features)

Test samples.

y : array-like, shape = (n_samples) or (n_samples, n_outputs)

True labels for X.

sample_weight : array-like, shape = [n_samples], optional

Sample weights.

Returns:

score : float

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