import sys 
!git checkout 44bfc66a8aef1baf6794ab43ea9c73e5be34ce8e && {sys.executable} -m pip install -e . > /dev/null

import numpy as np
from qiskit import Aer
from qiskit.utils import QuantumInstance
from qiskit_machine_learning.algorithms.classifiers import VQC

features = np.random.rand(20, 2)
target = [0, 0, 0, 0, 0, 1, 1, 1, 1, 1]
target = np.tile(target, 2)
print(f"Features:\n{features.T}")
print(f"Target:", target)

onehot_target = np.zeros((target.size, int(target.max() + 1)))
onehot_target[np.arange(target.size), target.astype(int)] = 1
print(onehot_target.T)

backend = Aer.get_backend("aer_simulator_statevector")
quantum_instance = QuantumInstance(backend)

vqc = VQC(
    num_qubits=2,
    loss="cross_entropy",
    warm_start=True,
    quantum_instance=quantum_instance,
)

vqc.fit(features[:10, :], onehot_target[:10])
print("First fit complete.")

vqc.fit(features[10:, :], onehot_target[10:])
print("Second fit complete.")

import sys
!git checkout 5a02c7639db6a86beb9a944b14721935a48932e6 && {sys.executable} -m pip install -e . > /dev/null