Bengali
ভাষাসমূহ
English
Bengali
French
Hindi
Italian
Japanese
Korean
Malayalam
Russian
Spanish
Tamil
Turkish
Vietnamese
Shortcuts



QuantumKernel

class QuantumKernel(feature_map=None, enforce_psd=True, batch_size=900, quantum_instance=None, user_parameters=None)[source]

Bases: object

Quantum Kernel.

The general task of machine learning is to find and study patterns in data. For many algorithms, the datapoints are better understood in a higher dimensional feature space, through the use of a kernel function:

\[K(x, y) = \langle f(x), f(y)\rangle.\]

Here K is the kernel function, x, y are n dimensional inputs. f is a map from n-dimension to m-dimension space. \(\langle x, y \rangle\) denotes the dot product. Usually m is much larger than n.

The quantum kernel algorithm calculates a kernel matrix, given datapoints x and y and feature map f, all of n dimension. This kernel matrix can then be used in classical machine learning algorithms such as support vector classification, spectral clustering or ridge regression.

প্যারামিটার
  • feature_map (Optional[QuantumCircuit]) -- Parameterized circuit to be used as the feature map. If None is given, the ZZFeatureMap is used with two qubits.

  • enforce_psd (bool) -- Project to closest positive semidefinite matrix if x = y. Only enforced when not using the state vector simulator. Default True.

  • batch_size (int) -- Number of circuits to batch together for computation. Default 900.

  • quantum_instance (Union[Backend, BaseBackend, QuantumInstance, None]) -- Quantum Instance or Backend

  • user_parameters (Union[ParameterVector, Sequence[Parameter], None]) -- Iterable containing Parameter objects which correspond to quantum gates on the feature map circuit which may be tuned. If users intend to tune feature map parameters to find optimal values, this field should be set.

Attributes

feature_map

Return feature map

quantum_instance

Return quantum instance

unbound_feature_map

Return unbound feature map

user_param_binds

Return a copy of the current user parameter mappings for the feature map circuit.

user_parameters

Return the vector of user parameters.

Methods

assign_user_parameters(values)

Assign user parameters in the QuantumKernel feature map.

bind_user_parameters(values)

Alternate function signature for assign_user_parameters

construct_circuit(x[, y, measurement, ...])

Construct inner product circuit for given datapoints and feature map.

evaluate(x_vec[, y_vec])

Construct kernel matrix for given data and feature map

get_unbound_user_parameters()

Return a list of any unbound user parameters in the feature map circuit.