Skip to content

Comment out QSVC/VQC and make retrain optional in quantum classification example#6

Merged
varunccf merged 1 commit into
mainfrom
copilot/comment-out-qsvc-qvc-algorithms
Jul 6, 2026
Merged

Comment out QSVC/VQC and make retrain optional in quantum classification example#6
varunccf merged 1 commit into
mainfrom
copilot/comment-out-qsvc-qvc-algorithms

Conversation

Copilot AI commented Jul 6, 2026

Copy link
Copy Markdown

The quantum classification example failed at runtime, and manually commenting out the retrain(...) call left epochs / error_rate undefined further down. QSVC and VQC baselines also need to be disabled for now.

Changes to examples/quantum/classification.py

  • Retrain toggle: introduced RETRAIN, RETRAIN_EPOCHS, RETRAIN_LR module constants. The retrain call is wrapped in if RETRAIN: ... else: ...; the else branch assigns safe defaults (error_rate=nan, epochs=0, fold_epoch_history=[]) so the checkpoint payload and downstream int(epochs) / float(error_rate) remain valid whether or not retrain runs. lr is now passed explicitly instead of relying on the model default.
  • QSVC / VQC disabled: commented out qiskit imports, per-fold QSVC and VQC training/eval blocks, their keys in the fold_data dict, the __main__ aggregation lists, print_cv_summary calls, ROC data prints, and roc_curve plot-point sections. Inline notes indicate exactly what to uncomment to re-enable.
RETRAIN = True
RETRAIN_EPOCHS = 10
RETRAIN_LR = 1.0

if RETRAIN:
    error_rate, epochs = model_q.retrain(
        X_train_fold, y_train_fold,
        epochs=RETRAIN_EPOCHS, lr=RETRAIN_LR, verbose=False,
    )
    fold_epoch_history = list(getattr(model_q, "retrain_history_", []))
else:
    error_rate = float("nan")
    epochs = 0
    fold_epoch_history = []

Flip RETRAIN = False at the top of the file to run the example without the retrain step; no other edits required.

@varunccf varunccf marked this pull request as ready for review July 6, 2026 13:09
@varunccf varunccf merged commit c7901a6 into main Jul 6, 2026
8 checks passed
@varunccf varunccf deleted the copilot/comment-out-qsvc-qvc-algorithms branch July 6, 2026 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants