sklearn.base.DensityMixin¶
- class sklearn.base.DensityMixin¶
Mixin class for all density estimators in scikit-learn.
This mixin defines the following functionality:
_estimator_typeclass attribute defaulting to"DensityEstimator";scoremethod that default that do no-op.
Examples
>>> from sklearn.base import DensityMixin >>> class MyEstimator(DensityMixin): ... def fit(self, X, y=None): ... self.is_fitted_ = True ... return self >>> estimator = MyEstimator() >>> hasattr(estimator, "score") True
Methods
score(X[, y])Return the score of the model on the data
X.- score(X, y=None)¶
Return the score of the model on the data
X.- Parameters:
- Xarray-like of shape (n_samples, n_features)
Test samples.
- yIgnored
Not used, present for API consistency by convention.
- Returns:
- scorefloat