QuantumClassifier
QuantumClassifier Parameters:¶
Core Parameters:¶
nqubits:Set[int]- Description: Set of qubit indices, where each value must be greater than 0.
-
Validation: Ensures that all elements are integers > 0.
-
randomstate:int - Description: Seed value for random number generation.
-
Default:
1234 -
predictions:bool - Description: Flag to determine if predictions are enabled.
- Default:
False
Model Structure Parameters:¶
numPredictors:int- Description: Number of predictors used in the QNN with bagging.
- Constraints: Must be greater than 0.
-
Default:
10 -
numLayers:int - Description: Number of layers in the Quantum Neural Networks.
- Constraints: Must be greater than 0.
- Default:
5
Set-Based Configuration Parameters:¶
classifiers:Set[Model]- Description: Set of classifier models.
- Constraints: Must contain at least one classifier.
- Default:
{Model.ALL} -
Options:
{Model.QNN, Model.QNNBAG, Model.MPSQNN, Model.QSVM, Model.FastQSVM, Model.MPSQSVM, Model.QKNN, Model.FastQKNN, Model.MPSQKNN} -
ansatzs:Set[Ansatzs] - Description: Set of quantum ansatz configurations.
- Constraints: Must contain at least one ansatz.
- Default:
{Ansatzs.ALL} -
Options:
{Ansatzs.HCZRX, Ansatzs.TREE_TENSOR, Ansatzs.TWO_LOCAL, Ansatzs.HARDWARE_EFFICIENT, Ansatzs.ANNULAR} -
embeddings:Set[Embedding] - Description: Set of embedding strategies.
- Constraints: Must contain at least one embedding.
- Default:
{Embedding.ALL} -
Options:
{Embedding.RX, Embedding.RY, Embedding.RZ, Embedding.ZZ, Embedding.ZZ_LOCAL, Embedding.AMP, Embedding.DENSE_ANGLE, Embedding.HIGHER_ORDER} -
features:Set[float] - Description: Set of feature values (must be between 0 and 1).
- Constraints: Values > 0 and <= 1.
- Default:
{0.3, 0.5, 0.8}
Training Parameters:¶
learningRate:float- Description: Learning rate for optimization.
- Constraints: Must be greater than 0.
-
Default:
0.01 -
epochs:int - Description: Number of training epochs.
- Constraints: Must be greater than 0.
-
Default:
100 -
batchSize:int - Description: Size of each batch during training.
- Constraints: Must be greater than 0.
- Default:
8
Threshold and Sampling:¶
threshold:int- Description: Decision threshold for parallelization, if the model is bigger than this threshold it will use GPU.
- Constraints: Must be greater than 0.
-
Default:
16 -
maxSamples:float - Description: Maximum proportion of samples to be used from the dataset characteristics.
- Constraints: Between 0 and 1.
- Default:
1.0
Logging and Metrics:¶
verbose:bool- Description: Flag for detailed output during training.
- Default:
False
QSVM / FastQSVM / MPSQSVM hyperparameters:¶
svmC:float- Description: Regularization strength for precomputed-kernel SVMs.
-
Default:
1.0 -
svmClassWeight:object - Description: Class weights passed to the underlying
SVC. -
Default:
None -
svmTol:float - Description: Optimization tolerance for the
SVCsolver. -
Default:
1e-3 -
svmCacheSize:int - Description: Cache size in MB for the
SVCsolver. -
Default:
200 -
svmMaxIter:int - Description: Maximum number of iterations for the
SVCsolver. -
Default:
-1 -
svmShrinking:bool - Description: Enables or disables the shrinking heuristic.
-
Default:
True -
svmProbability:bool - Description: Enables probability calibration in
SVC. -
Default:
False -
svmRandomState:int - Description: Random seed used by the
SVCsolver. If omitted, the experiment seed is reused. -
Default:
None -
svmDecisionFunctionShape:str - Description: Multiclass decision function shape for
SVC. -
Default:
"ovr" -
svmBreakTies:bool - Description: Enables tie-breaking for multiclass
SVCpredictions. -
Default:
False -
svmVerbose:bool - Description: Enables verbose output from libsvm.
-
Default:
False -
customMetric:Optional[Callable] - Description: User-defined metric function for evaluation.
- Validation:
- Function must accept
y_trueandy_predas the first two arguments. - Must return a scalar value (int or float).
- Function execution is validated with dummy arguments.
- Function must accept
- Default:
None
Custom Preprocessors:¶
customImputerNum:Optional[Any]- Description: Custom numeric data imputer.
- Validation:
- Must be an object with
fit,transform, and optionallyfit_transformmethods. - Validated with dummy data.
- Must be an object with
-
Default:
None -
customImputerCat:Optional[Any] - Description: Custom categorical data imputer.
- Validation:
- Must be an object with
fit,transform, and optionallyfit_transformmethods. - Validated with dummy data.
- Must be an object with
- Default:
None
Functions:¶
fit¶
1 | |
X and y using a hold-out approach. Predicts and scores on a test set determined by test_size.
Parameters:¶
X: Input features (DataFrame or compatible format).y: Target labels (must be numeric, e.g., viaLabelEncoderorOrdinalEncoder).test_size: Proportion of the dataset to use as the test set. Default is0.4.showTable: Display a table with results. Default isTrue.
Behavior:¶
- Validates the compatibility of input dimensions.
- Automatically applies PCA transformation for incompatible dimensions.
- Requires all categories to be present in training data.
repeated_cross_validation¶
1 | |
Parameters:¶
X: Input features (DataFrame or compatible format).y: Target labels (must be numeric).n_splits: Number of folds for splitting the dataset. Default is10.n_repeats: Number of times cross-validation is repeated. Default is5.showTable: Display a table with results. Default isTrue.
Behavior:¶
- Uses
RepeatedStratifiedKFoldfor generating splits. - Aggregates results from multiple train-test splits.
leave_one_out¶
1 | |
Parameters:¶
X: Input features (DataFrame or compatible format).y: Target labels (must be numeric).showTable: Display a table with results. Default isTrue.
Behavior:¶
- Uses
LeaveOneOutfor generating train-test splits. - Evaluates the model on each split and aggregates results.