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.QSVM, Model.QNN_BAG}
-
ansatzs
:Set[Ansatzs]
- Description: Set of quantum ansatz configurations.
- Constraints: Must contain at least one ansatz.
- Default:
{Ansatzs.ALL}
-
Options:
{Ansatzs.RX, Ansatzs.RZ, Ansatzs.RY, Ansatzs.ZZ, Ansatzs.AMP}
-
embeddings
:Set[Embedding]
- Description: Set of embedding strategies.
- Constraints: Must contain at least one embedding.
- Default:
{Embedding.ALL}
-
Options:
{Embedding.HCZRX, Embedding.TREE_TENSOR, Embedding.TWO_LOCAL, Embedding.HARDWARE_EFFICENT}
-
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:
22
-
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
-
customMetric
:Optional[Callable]
- Description: User-defined metric function for evaluation.
- Validation:
- Function must accept
y_true
andy_pred
as 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_transform
methods. - 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_transform
methods. - 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., viaLabelEncoder
orOrdinalEncoder
).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
RepeatedStratifiedKFold
for 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
LeaveOneOut
for generating train-test splits. - Evaluates the model on each split and aggregates results.