ertk.sklearn.utils.OneVsRestClassifier
- class ertk.sklearn.utils.OneVsRestClassifier(estimator, *, n_jobs=None, verbose=0)
Bases:
OneVsRestClassifier- __init__(estimator, *, n_jobs=None, verbose=0)
Methods
fit(X, y, **kwargs)Fit underlying estimators.
set_partial_fit_request(*[, classes])Configure whether metadata should be requested to be passed to the
partial_fitmethod.set_score_request(*[, sample_weight])Configure whether metadata should be requested to be passed to the
scoremethod.Inherited Methods
__init__(estimator, *[, n_jobs, verbose])decision_function(X)Decision function for the OneVsRestClassifier.
get_metadata_routing()Get metadata routing of this object.
get_params([deep])Get parameters for this estimator.
partial_fit(X, y[, classes])Partially fit underlying estimators.
predict(X)Predict multi-class targets using underlying estimators.
predict_proba(X)Probability estimates.
score(X, y[, sample_weight])Return accuracy on provided data and labels.
set_params(**params)Set the parameters of this estimator.
Attributes
multilabel_Whether this is a multilabel classifier.
n_classes_Number of classes.
- fit(X, y, **kwargs)
Fit underlying estimators.
- Parameters:
- X{array-like, sparse matrix} of shape (n_samples, n_features)
Data.
- y{array-like, sparse matrix} of shape (n_samples,) or (n_samples, n_classes)
Multi-class targets. An indicator matrix turns on multilabel classification.
- **fit_paramsdict
Parameters passed to the
estimator.fitmethod of each sub-estimator.New in version 1.4: Only available if
enable_metadata_routing=True. See Metadata Routing User Guide for more details.
- Returns:
- selfobject
Instance of fitted estimator.
- set_partial_fit_request(*, classes: bool | None | str = '$UNCHANGED$') OneVsRestClassifier
Configure whether metadata should be requested to be passed to the
partial_fitmethod.Note that this method is only relevant when this estimator is used as a sub-estimator within a meta-estimator and metadata routing is enabled with
enable_metadata_routing=True(seesklearn.set_config()). Please check the User Guide on how the routing mechanism works.The options for each parameter are:
True: metadata is requested, and passed topartial_fitif provided. The request is ignored if metadata is not provided.False: metadata is not requested and the meta-estimator will not pass it topartial_fit.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.New in version 1.3.
- Parameters:
- classesstr, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED
Metadata routing for
classesparameter inpartial_fit.
- Returns:
- selfobject
The updated object.
- set_score_request(*, sample_weight: bool | None | str = '$UNCHANGED$') OneVsRestClassifier
Configure whether metadata should be requested to be passed to the
scoremethod.Note that this method is only relevant when this estimator is used as a sub-estimator within a meta-estimator and metadata routing is enabled with
enable_metadata_routing=True(seesklearn.set_config()). Please check the User Guide on how the routing mechanism works.The options for each parameter are:
True: metadata is requested, and passed toscoreif provided. The request is ignored if metadata is not provided.False: metadata is not requested and the meta-estimator will not pass it toscore.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.New in version 1.3.
- Parameters:
- sample_weightstr, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED
Metadata routing for
sample_weightparameter inscore.
- Returns:
- selfobject
The updated object.