VQR¶
- class VQR(num_qubits=None, feature_map=None, ansatz=None, observable=None, loss='squared_error', optimizer=None, warm_start=False, quantum_instance=None, initial_point=None, callback=None)[исходный код]¶
Базовые классы:
qiskit_machine_learning.algorithms.regressors.neural_network_regressor.NeuralNetworkRegressor
Quantum neural network regressor using TwoLayerQNN
- Параметры
num_qubits (
Optional
[int
]) – The number of qubits to be used. If None, and neither feature_map nor ansatz are given, it is initially set to 2, i.e., the default of the TwoLayerQNN.feature_map (
Optional
[QuantumCircuit
]) – The feature map to be used to construct a TwoLayerQNN. If None, use the ZZFeatureMap, i.e., the default of the TwoLayerQNN.ansatz (
Optional
[QuantumCircuit
]) – The ansatz to be used to construct a TwoLayerQNN. If None, use the RealAmplitudes, i.e., the default of the TwoLayerQNN.observable (
Union
[QuantumCircuit
,OperatorBase
,None
]) – The observable to be measured in the underlying TwoLayerQNN. If None, use the default from the TwoLayerQNN, i.e., Z^{otimes num_qubits}.loss (
Union
[str
,Loss
]) – A target loss function to be used in training. Default is squared error.optimizer (
Optional
[Optimizer
]) – An instance of an optimizer to be used in training. When None defaults to SLSQP.warm_start (
bool
) – Use weights from previous fit to start next fit.quantum_instance (
Optional
[QuantumInstance
]) – The quantum instance to execute circuits on.initial_point (
Optional
[ndarray
]) – Initial point for the optimizer to start from.callback (
Optional
[Callable
[[ndarray
,float
],None
]]) – a reference to a user’s callback function that has two parameters and returnsNone
. The callback can access intermediate data during training. On each iteration an optimizer invokes the callback and passes current weights as an array and a computed value as a float of the objective function being optimized. This allows to track how well optimization / training process is going on.
- Исключение
QiskitMachineLearningError – Neither num_qubits, nor feature_map, nor ansatz given.
Attributes
Returns the used ansatz.
Returns the used feature map.
Returns the number of qubits used by ansatz and feature map.
Methods