Japanese
言語
English
Japanese
German
Korean
Portuguese, Brazilian
French
Shortcuts

qiskit.aqua.components.multiclass_extensions.ErrorCorrectingCode

class ErrorCorrectingCode(code_size=4)[ソース]

The Error Correcting Code multiclass extension.

Error Correcting Code (ECC) is an ensemble method designed for the multiclass classification problem. As for the other multiclass methods, the task is to decide one label from \(k > 2\) possible choices.

Class

Code Word

\(f_0\)

\(f_1\)

\(f_2\)

\(f_3\)

\(f_4\)

\(f_5\)

1

0

1

0

1

0

1

2

1

0

0

1

0

0

3

1

1

1

0

0

0

The table above shows a 6-bit ECC for a 3-class problem. Each class is assigned a unique binary string of length 6. The string is also called a codeword. For example, class 2 has codeword 100100. During training, one binary classifier is learned for each column. For example, for the first column, ECC builds a binary classifier to separate \(\{2, 3\}\) from \(\{1\}\). Thus, 6 binary classifiers are trained in this way. To classify a new data point \(\mathbf{x}\), all 6 binary classifiers are evaluated to obtain a 6-bit string. Finally, we choose the class whose bitstring is closest to \(\mathbf{x}\)’s output string as the predicted label. This implementation of ECC uses the Euclidean distance.

パラメータ

code_size (int) – Size of error correcting code

__init__(code_size=4)[ソース]
パラメータ

code_size (int) – Size of error correcting code

Methods

__init__([code_size])

type code_size

int

predict(x)

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