qbiocode.learning package#

Machine Learning Module for QBioCode#

This module provides implementations of classical and quantum machine learning algorithms for classification tasks. Each algorithm includes both standard and optimized versions (where applicable) with hyperparameter tuning.

Classical Algorithms#

  • Decision Tree (DT)

  • Logistic Regression (LR)

  • Multi-Layer Perceptron (MLP)

  • Naive Bayes (NB)

  • Random Forest (RF)

  • Support Vector Classifier (SVC)

  • XGBoost (XGB)

Quantum Algorithms#

  • Quantum Neural Network (QNN)

  • Quantum Support Vector Classifier (QSVC)

  • Variational Quantum Classifier (VQC)

  • Projected Quantum Kernel (PQK)

  • Quantum Ensemble (QEnsemble) - supports both fixed swap and random unitary methods

Usage#

>>> from qbiocode.learning import compute_rf, compute_qsvc, compute_qensemble
>>> # Train classical model
>>> results = compute_rf(X_train, y_train, X_test, y_test)
>>> # Train quantum model
>>> qresults = compute_qsvc(X_train, y_train, X_test, y_test)
>>> # Train quantum ensemble with fixed swaps (default)
>>> qens_results = compute_qensemble(X_train, X_test, y_train, y_test, args)
>>> # Train quantum ensemble with random unitaries
>>> qens_random = compute_qensemble(X_train, X_test, y_train, y_test, args,
...                                 ensemble_method="random_unitary")

Submodules:

Summary#

__all__ Functions:

compute_dt

This function generates a model using a Decision Tree (DT) Classifier method as implemented in scikit-learn.

compute_dt_opt

This function also generates a model using a Decision Tree (DT) Classifier method as implemented in scikit-learn.

compute_lr

This function generates a model using a Logistic Regression (LR) method as implemented in scikit-learn.

compute_lr_opt

This function also generates a model using a Logistic Regression (LR) method as implemented in scikit-learn.

compute_mlp

This function generates a model using a Multi-layer Perceptron (mlp), a neural network, method as implemented in scikit-learn.

compute_mlp_opt

This function also generates a model using a Multi-layer Perceptron (mlp), a neural network, as implemented in scikit-learn (https://scikit-learn.org/stable/modules/generated/sklearn.neural_network.MLPClassifier.html).

compute_nb

This function generates a model using a Gaussian Naive Bayes (NB) Classifier method as implemented in scikit-learn.

compute_nb_opt

This function generates a model using a Gaussian Naive Bayes (NB) Classifier method as implemented in scikit-learn.

compute_pqk

This function generates quantum circuits, computes projections of the data onto these circuits, and evaluates the performance of classical machine learning models on the projected data.

compute_qensemble

Compute quantum ensemble classifier predictions.

compute_qnn

This function computes a Quantum Neural Network (QNN) model on the provided training data and evaluates it on the test data.

compute_qpl

This function generates quantum circuits, computes projections of the data onto these circuits, and evaluates the performance of classical machine learning models on the projected data.

compute_qsvc

This function computes a quantum support vector classifier (QSVC) using the Qiskit Machine Learning library.

compute_rf

This function generates a model using a Random Forest (RF) Classifier method as implemented in scikit-learn.

compute_rf_opt

This function also generates a model using a Random Forest (RF) Classifier method as implemented in scikit-learn.

compute_svc

This function generates a model using a Support Vector Classifier (SVC) method as implemented in scikit-learn.

compute_svc_opt

This function generates a model using a Support Vector Classifier (SVC) method as implemented in scikit-learn.

compute_vqc

This function computes a Variational Quantum Classifier (VQC) using the Qiskit Machine Learning library.

compute_xgb

This function generates a model using an Extreme Gradient Boositing (xgb) Classifier method as implemented in xgboost.

compute_xgb_opt

This function generates a model using an Extreme Gradient Boositing (xgb) Classifier method as implemented in xgboost.