FAQ

Installation

Why do I get an error when running ``pip install qkabrine-automl``?

Make sure you have Python 3.9 or later:

python --version

If you’re on an older version, upgrade Python first from python.org.

PennyLane fails to install — what do I do?

Try installing it separately first:

pip install pennylane
pip install qkabrine-automl

If you’re on Windows and get a build error, make sure you have the latest pip:

python -m pip install --upgrade pip
pip install qkabrine-automl

Data and Features

My dataset has 100 features but only 4 qubits — what happens?

Qkabrine automatically reduces your features to match the qubit count using the method set by feature_reduction. The default is PCA:

automl = QkabrineAutoML(
    n_qubits=4,
    feature_reduction='pca',   # reduces 100 features → 4 principal components
)

Other options: 'random_projection', 'select_variance', or None (which just takes the first N features — not recommended for large feature sets).

Does Qkabrine handle categorical features?

No — it expects numerical input only. Encode your categorical features first using scikit-learn’s LabelEncoder or OneHotEncoder before passing data to Qkabrine.

My labels are strings like “cat” and “dog” — is that OK?

Yes. Qkabrine’s LabelEncoder handles string labels automatically. predict() will return the original string labels back.

Models and Results

How do I know which model won — variational or kernel?

After fitting, check:

print(automl._best['model_type'])   # 'variational' or 'kernel'
print(automl._best['name'])         # e.g. 'hardware_efficient' or 'kernel_iqp'

Or just call automl.leaderboard() — the Type column shows var or kernel.

Can I save and reload my model?

Yes — save/load works for both variational and kernel models:

automl.save('my_model.pkl')

# Later, in any script:
loaded = QkabrineAutoML.load('my_model.pkl')
preds = loaded.predict(X_new)

``predict_proba`` is raising an error — why?

Two common reasons:

  1. You’re calling it on a regression model — it’s only valid for classification

  2. The best model is a quantum kernel — kernel models don’t support predict_proba

Check with:

print(automl.task)                    # must be 'classification'
print(automl._best['model_type'])     # must not be 'kernel'

The leaderboard shows many models with the same score — is that normal?

Yes, especially for small datasets where many circuits hit the ceiling (e.g. 100% accuracy on a simple dataset) or the floor (50% random chance). The first one listed among ties is selected as best. You can inspect all tied models in automl._results.

Advanced Usage

What is a barren plateau and should I worry about it?

A barren plateau is when gradients become so small that training makes no progress — the circuit’s loss landscape becomes completely flat. It’s more common with deep circuits and many qubits.

Enable monitoring to detect and skip affected circuits automatically:

automl = QkabrineAutoML(
    monitor_barren_plateaus=True,
    use_dqfim_prescreening=True,
)

What is DQFIM prescreening?

DQFIM (Data Quantum Fisher Information Matrix) is a technique that estimates how trainable a circuit is before spending time actually training it. Circuits with a trainability score below 0.05 are skipped.

Enable it with use_dqfim_prescreening=True. It adds a small overhead per candidate but can save significant time on deep circuits.

Can I search over multiple encodings at once?

Yes — pass a tuple:

automl = QkabrineAutoML(
    encodings=('angle', 'iqp', 'angle_yz'),
)

Each circuit architecture will be tested with each encoding combination, so the search space grows. Consider also setting a time_budget.

Getting Help