BrushClassifier#

class pybrush.BrushClassifier(**kwargs)[source]#

Brush with c++ engine for classification.

Parameters are defined and documented in EstimatorInterface

This class inherits from BrushEstimator. A full documentation of the methods and attributes can be found there.

Examples

>>> import pandas as pd
>>> df = pd.read_csv('docs/examples/datasets/d_analcatdata_aids.csv')
>>> X = df.drop(columns='target')
>>> y = df['target']
>>> from pybrush import BrushClassifier
>>> est = BrushClassifier()
>>> est.fit(X,y)
>>> # print('score:', est.score(X,y))

Methods

fit(X, y)

Fit an estimator to X,y.

get_metadata_routing()

Get metadata routing of this object.

get_params([deep])

Get parameters for this estimator.

predict(X)

Predict using the best estimator in the archive.

predict_archive(X)

Returns a list of dictionary predictions for all models.

predict_proba(X)

Predict class probabilities for X.

predict_proba_archive(X)

Returns a list of dictionary predictions for all models.

score(X, y[, sample_weight])

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

set_params(**params)

Set the parameters of this estimator.

set_score_request(*[, sample_weight])

Request metadata passed to the score method.

predict_proba(X)[source]#

Predict class probabilities for X.

Parameters:
X{array-like} of shape (n_samples, n_features)

The input samples.

Returns:
pndarray of shape (n_samples, n_classes)

The class probabilities of the input samples.

predict_proba_archive(X)[source]#

Returns a list of dictionary predictions for all models.

set_score_request(*, sample_weight: bool | None | str = '$UNCHANGED$') BrushClassifier[source]#

Request metadata passed to the score method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to score if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to score.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

Added in version 1.3.

Note

This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a Pipeline. Otherwise it has no effect.

Parameters:
sample_weightstr, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED

Metadata routing for sample_weight parameter in score.

Returns:
selfobject

The updated object.