Note

This is the documentation for the current state of the development branch of Qiskit Experiments. The documentation or APIs here can change prior to being released.

SVD

class SVD(validate=True)[source]

Singular Value Decomposition of averaged IQ data.

Create new action.

Parameters:

validate (bool) – If set to False the DataAction will not validate its input.

Attributes

is_trained

Return False if the DataAction needs to be trained.

A node is considered trained if all its parameters are assigned, or do not have None values.

Returns:

True if the data action has been trained.

parameters

Return the parameters of the trainable node.

Methods

__call__(data)

Call the data action of this node on the data.

Parameters:

data (ndarray) – A numpy array with arbitrary dtype. If the elements are ufloat objects consisting of a nominal value and a standard error, then the error propagation is done automatically.

Returns:

The processed data.

Return type:

ndarray

set_parameters(**fields)

Set parameters for training.

train(data)[source]

Train the SVD on the given data.

Each element of the given data will be converted to a 2D array of dimension n_qubits x 2. The number of qubits is inferred from the shape of the data. For each qubit the data is collected into an array of shape 2 x n_data_points. The mean of the in-phase a quadratures is subtracted before passing the data to numpy’s svd function. The dominant axis and the scale is saved for each qubit so that future data points can be projected onto the axis.

Note

Before training the SVD the mean of the training data is subtracted from the training data to avoid large offsets in the data. These means can be retrieved with parameters.i_means or parameters.q_means for I and Q quadrature, respectively.

Parameters:

data (ndarray) – A data array to be trained. This is a single numpy array containing all circuit results input to the data processor.