# qiskit.aqua.components.multiclass_extensions.AllPairs¶

class AllPairs[소스]

The All-Pairs multiclass extension.

In the all-pairs reduction, one trains $$k(k−1)/2$$ binary classifiers for a $$k$$-way multiclass problem; each receives the samples of a pair of classes from the original training set, and must learn to distinguish these two classes. At prediction time, a weighted voting scheme is used: all $$k(k−1)/2$$ classifiers are applied to an unseen sample, and each class gets assigned the sum of all the scores obtained by the various classifiers. The combined classifier returns as a result the class getting the highest value.

__init__()[소스]

Initialize self. See help(type(self)) for accurate signature.

Methods

 Initialize self. Applying multiple estimators for prediction. set_estimator(estimator_cls[, params]) Called internally to set Estimator and parameters :type estimator_cls: Callable[[List], Estimator] :param estimator_cls: An Estimator class :type params: Optional[List] :param params: Parameters for the estimator test(x, y) Testing multiple estimators each for distinguishing a pair of classes. train(x, y) Training multiple estimators each for distinguishing a pair of classes.
predict(x)[소스]

Applying multiple estimators for prediction.

매개변수

x (numpy.ndarray) – NxD array

반환값

predicted labels, Nx1 array

반환 형식

numpy.ndarray

set_estimator(estimator_cls, params=None)

Called internally to set Estimator and parameters :type estimator_cls: Callable[[List], Estimator] :param estimator_cls: An Estimator class :type params: Optional[List] :param params: Parameters for the estimator

반환 형식

None

test(x, y)[소스]

Testing multiple estimators each for distinguishing a pair of classes.

매개변수
• x (numpy.ndarray) – input points

• y (numpy.ndarray) – input labels

반환값

accuracy

반환 형식

float

train(x, y)[소스]

Training multiple estimators each for distinguishing a pair of classes.

매개변수
• x (numpy.ndarray) – input points

• y (numpy.ndarray) – input labels

예외

ValueError – can not be fit when only one class is present.