0
$\begingroup$

How can we save a trained model using Qiskit Machine Learning library? I've built a VQC classification model and once finished, I'd like to save the different models to be loaded later. There is a save_model method in Qiskit Aqua (from qiskit.aqua.algorithms import VQC) but for Qiskit Machine Learning (from qiskit_machine_learning.algorithms.classifiers import VQC) I havent found it yet.

Thanks!

$\endgroup$
0
$\begingroup$

Qiskit ML VQC is a lightweight sub-class of sklearn SVC that supplies the quantum kernel to the SVC. You can therefore leverage sklearns capabilities to say save/restore models see https://scikit-learn.org/stable/modules/model_persistence.html#python-specific-serialization

$\endgroup$
1
  • $\begingroup$ Thanks Steve!, but using pickle or np.savez (as the same way as aqua uses in save_model method) does no work, but with joblib it finally does. $\endgroup$ – Eva Andres Jul 8 at 19:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.