OneVsRestCalibrator¶
-
class
pycalib.calibration_methods.
OneVsRestCalibrator
(calibrator, n_jobs=None)[source]¶ Bases:
sklearn.base.BaseEstimator
One-vs-the-rest (OvR) multiclass strategy Also known as one-vs-all, this strategy consists in fitting one calibrator per class. The probabilities to be calibrated of the other classes are summed. For each calibrator, the class is fitted against all the other classes.
- Parameters
calibrator (CalibrationMethod object) – A CalibrationMethod object implementing fit and predict_proba.
n_jobs (int or None, optional (default=None)) – The number of jobs to use for the computation.
None
means 1 unless in ajoblib.parallel_backend
context.-1
means using all processors. for more details.
-
calibrators_
¶ Estimators used for predictions.
- Type
list of n_classes estimators
-
classes_
¶ Class labels.
- Type
array, shape = [n_classes]
-
label_binarizer_
¶ Object used to transform multiclass labels to binary labels and vice-versa.
- Type
LabelBinarizer object
Attributes Summary
Methods Summary
fit
(X, y)Fit underlying estimators.
get_params
([deep])Get parameters for this estimator.
Probability estimates.
set_params
(**params)Set the parameters of this estimator.
Attributes Documentation
-
n_classes_
¶
Methods Documentation
-
fit
(X, y)[source]¶ Fit underlying estimators. :param X: Calibration data. :type X: (sparse) array-like, shape = [n_samples, n_features] :param y: Multi-class labels. :type y: (sparse) array-like, shape = [n_samples, ]
- Returns
- Return type
self
-
get_params
(deep=True)¶ Get parameters for this estimator.
- Parameters
deep (bool, default=True) – If True, will return the parameters for this estimator and contained subobjects that are estimators.
- Returns
params – Parameter names mapped to their values.
- Return type
mapping of string to any
-
predict_proba
(X)[source]¶ Probability estimates.
The returned estimates for all classes are ordered by label of classes.
- Parameters
X (array-like, shape = [n_samples, n_features]) –
- Returns
T – Returns the probability of the sample for each class in the model, where classes are ordered as they are in self.classes_.
- Return type
(sparse) array-like, shape = [n_samples, n_classes]
-
set_params
(**params)¶ Set the parameters of this estimator.
The method works on simple estimators as well as on nested objects (such as pipelines). The latter have parameters of the form
<component>__<parameter>
so that it’s possible to update each component of a nested object.