One-vs-one multiclass strategy.
This strategy consists in fitting one classifier per class pair. At prediction time, the class which received the most votes is selected. Since it requires to fit n\_classes \* (n\_classes \- 1) / 2
classifiers, this method is usually slower than one-vs-the-rest, due to its O(n_classes^2) complexity. However, this method may be advantageous for algorithms such as kernel algorithms which don’t scale well with n\_samples
. This is because each individual learning problem only involves a small subset of the data whereas, with one-vs-the-rest, the complete dataset is used n\_classes
times.
Read more in the User Guide.
new OneVsOneClassifier(opts?: object): OneVsOneClassifier;
Name | Type | Description |
---|---|---|
opts? |
object |
- |
opts.estimator? |
any |
A regressor or a classifier that implements fit. When a classifier is passed, decision_function will be used in priority and it will fallback to predict_proba if it is not available. When a regressor is passed, predict is used. |
opts.n_jobs? |
number |
The number of jobs to use for the computation: the n\_classes \* ( n\_classes \- 1) / 2 OVO problems are computed in parallel. undefined means 1 unless in a joblib.parallel\_backend context. \-1 means using all processors. See Glossary for more details. |
Defined in: generated/multiclass/OneVsOneClassifier.ts:25
Decision function for the OneVsOneClassifier.
The decision values for the samples are computed by adding the normalized sum of pair-wise classification confidence levels to the votes in order to disambiguate between the decision values when the votes for all the classes are equal leading to a tie.
decision_function(opts: object): Promise<ArrayLike[]>;
Name | Type | Description |
---|---|---|
opts |
object |
- |
opts.X? |
ArrayLike [] |
Input data. |
Promise
<ArrayLike
[]>
Defined in: generated/multiclass/OneVsOneClassifier.ts:118
Disposes of the underlying Python resources.
Once dispose()
is called, the instance is no longer usable.
dispose(): Promise<void>;
Promise
<void
>
Defined in: generated/multiclass/OneVsOneClassifier.ts:99
Fit underlying estimators.
fit(opts: object): Promise<any>;
Name | Type | Description |
---|---|---|
opts |
object |
- |
opts.X? |
ArrayLike |
Data. |
opts.y? |
ArrayLike |
Multi-class targets. |
Promise
<any
>
Defined in: generated/multiclass/OneVsOneClassifier.ts:156
Get metadata routing of this object.
Please check User Guide on how the routing mechanism works.
get_metadata_routing(opts: object): Promise<any>;
Name | Type | Description |
---|---|---|
opts |
object |
- |
opts.routing? |
any |
A MetadataRequest encapsulating routing information. |
Promise
<any
>
Defined in: generated/multiclass/OneVsOneClassifier.ts:200
Initializes the underlying Python resources.
This instance is not usable until the Promise
returned by init()
resolves.
init(py: PythonBridge): Promise<void>;
Name | Type |
---|---|
py |
PythonBridge |
Promise
<void
>
Defined in: generated/multiclass/OneVsOneClassifier.ts:55
Partially fit underlying estimators.
Should be used when memory is inefficient to train all data. Chunks of data can be passed in several iteration, where the first call should have an array of all target variables.
partial_fit(opts: object): Promise<any>;
Name | Type | Description |
---|---|---|
opts |
object |
- |
opts.X? |
any [] |
Data. |
opts.classes? |
any |
Classes across all calls to partial_fit. Can be obtained via np.unique(y\_all) , where y_all is the target vector of the entire dataset. This argument is only required in the first call of partial_fit and can be omitted in the subsequent calls. |
opts.y? |
ArrayLike |
Multi-class targets. |
Promise
<any
>
Defined in: generated/multiclass/OneVsOneClassifier.ts:240
Estimate the best class label for each sample in X.
This is implemented as argmax(decision\_function(X), axis=1)
which will return the label of the class with most votes by estimators predicting the outcome of a decision for each possible class pair.
predict(opts: object): Promise<any>;
Name | Type | Description |
---|---|---|
opts |
object |
- |
opts.X? |
ArrayLike |
Data. |
Promise
<any
>
Defined in: generated/multiclass/OneVsOneClassifier.ts:293
Return the mean accuracy on the given test data and labels.
In multi-label classification, this is the subset accuracy which is a harsh metric since you require for each sample that each label set be correctly predicted.
score(opts: object): Promise<number>;
Name | Type | Description |
---|---|---|
opts |
object |
- |
opts.X? |
ArrayLike [] |
Test samples. |
opts.sample_weight? |
ArrayLike |
Sample weights. |
opts.y? |
ArrayLike |
True labels for X . |
Promise
<number
>
Defined in: generated/multiclass/OneVsOneClassifier.ts:330
Request metadata passed to the partial\_fit
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:
set_partial_fit_request(opts: object): Promise<any>;
Name | Type | Description |
---|---|---|
opts |
object |
- |
opts.classes? |
string | boolean |
Metadata routing for classes parameter in partial\_fit . |
Promise
<any
>
Defined in: generated/multiclass/OneVsOneClassifier.ts:383
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:
set_score_request(opts: object): Promise<any>;
Name | Type | Description |
---|---|---|
opts |
object |
- |
opts.sample_weight? |
string | boolean |
Metadata routing for sample\_weight parameter in score . |
Promise
<any
>
Defined in: generated/multiclass/OneVsOneClassifier.ts:425
boolean
=false
Defined in: generated/multiclass/OneVsOneClassifier.ts:23
boolean
=false
Defined in: generated/multiclass/OneVsOneClassifier.ts:22
PythonBridge
Defined in: generated/multiclass/OneVsOneClassifier.ts:21
string
Defined in: generated/multiclass/OneVsOneClassifier.ts:18
any
Defined in: generated/multiclass/OneVsOneClassifier.ts:19
Array containing labels.
classes_(): Promise<any>;
Promise
<any
>
Defined in: generated/multiclass/OneVsOneClassifier.ts:490
Estimators used for predictions.
estimators_(): Promise<any>;
Promise
<any
>
Defined in: generated/multiclass/OneVsOneClassifier.ts:463
Names of features seen during fit. Defined only when X
has feature names that are all strings.
feature_names_in_(): Promise<ArrayLike>;
Promise
<ArrayLike
>
Defined in: generated/multiclass/OneVsOneClassifier.ts:571
Number of features seen during fit.
n_features_in_(): Promise<number>;
Promise
<number
>
Defined in: generated/multiclass/OneVsOneClassifier.ts:544
Indices of samples used when training the estimators. undefined
when estimator
’s pairwise
tag is false
.
pairwise_indices_(): Promise<any[]>;
Promise
<any
[]>
Defined in: generated/multiclass/OneVsOneClassifier.ts:517
py(): PythonBridge;
PythonBridge
Defined in: generated/multiclass/OneVsOneClassifier.ts:42
py(pythonBridge: PythonBridge): void;
Name | Type |
---|---|
pythonBridge |
PythonBridge |
void
Defined in: generated/multiclass/OneVsOneClassifier.ts:46