DensityMixin#

classsklearn.base.DensityMixin[source]#

Mixin class for all density estimators in scikit-learn.

This mixin defines the following functionality:

  • sets estimator type to"density_estimator" through theestimator_type tag;

  • score method that default that do no-op.

Examples

>>>fromsklearn.baseimportDensityMixin>>>classMyEstimator(DensityMixin):...deffit(self,X,y=None):...self.is_fitted_=True...returnself>>>estimator=MyEstimator()>>>hasattr(estimator,"score")True
score(X,y=None)[source]#

Return the score of the model on the dataX.

Parameters:
Xarray-like of shape (n_samples, n_features)

Test samples.

yIgnored

Not used, present for API consistency by convention.

Returns:
scorefloat
On this page

This Page