VQC¶
- class VQC(num_qubits=None, feature_map=None, ansatz=None, loss='cross_entropy', optimizer=None, warm_start=False, quantum_instance=None, initial_point=None, callback=None)[소스]¶
기반 클래스:
qiskit_machine_learning.algorithms.classifiers.neural_network_classifier.NeuralNetworkClassifier
Quantum neural network classifier.
- 매개변수
num_qubits (
Optional
[int
]) – The number of qubits for the underlying CircuitQNN. If None, derive from feature_map or ansatz. If neither of those is given, raise exception.feature_map (
Optional
[QuantumCircuit
]) – The feature map for underlying CircuitQNN. If None, use ZZFeatureMap.ansatz (
Optional
[QuantumCircuit
]) – The ansatz for the underlying CircuitQNN. If None, use RealAmplitudes.loss (
Union
[str
,Loss
]) – A target loss function to be used in training. Default is cross entropy.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.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 – Needs at least one out of num_qubits, feature_map or ansatz to be given.
Attributes
Returns the used ansatz.
Returns the underlying quantum circuit.
Returns the used feature map.
Returns the number of qubits used by ansatz and feature map.
Methods
fit
(X, y)Fit the model to data matrix X and targets y.