qiskit_addon_qcbm.born_machine¶
Define the Quantum Circuit Born Machine.
Classes¶
Module Contents¶
- class QCBM(num_qubits, num_layers, ansatz=None, data=None)¶
Quantum Circuit Born Machine
- num_layers¶
- num_qubits¶
- data = None¶
- draw()¶
Draw the QCBM circuit.
- print()¶
Provide the stats on the QCBM.
- train(data=None, loss_fcn=None, num_iterations=10, num_shots=100, backend=FakeFez())¶
Train the QCBM.
- compute_loss(params, ansatz_isa, sampler, loss_fcn, train_history, target_probs)¶
Return the value of the loss function.
- Parameters:
params (ndarray) – Array of ansatz parameters
ansatz_isa (QuantumCircuit) – Parameterized transpiled ansatz
sampler (SamplerV2) – Sampler primitive instance
loss_fcn (python function) – Function using to compute the loss
train_history (dict) – Dictionary for storing intermediate results
target_probs (ndarray) – the actual probability distribution
- Returns:
Scalar loss value
- Return type:
- plot_compare_model_and_target_probs(x_max, target_probs, qcbm_probs)¶
Compare the probabilities obtained with QCBM with the actual probability distribution.