Skip to content

Latest commit

 

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

FLIQ

Qubit_Minds: Using Quantum Neural Networks to diagnose to malignant breast cancer tumors

<title>Hybrid Quantum–Classical Classification</title>

Hybrid Quantum–Classical Classification

Overview

This Jupyter notebook implements and compares three classifiers—classical-only, quantum-only, and hybrid quantum–classical—on two biomedical datasets. It demonstrates end-to-end training, explainability, adversarial robustness, human-in-the-loop validation, and governance-style metadata logging.

Datasets

1. Breast Cancer Wisconsin (Diagnostic)

  • File: wdbc.data
  • Source: UCI Machine Learning Repository
  • Placement: Notebook’s working directory

2. Drug-Induced Autoimmunity Prediction

  • Files: DIA_trainingset.csv, DIA_testset.csv
  • Source: UCI Machine Learning Repository
  • Placement: Same folder as Hybrid_Model.ipynb

Installation

Create a Python 3 environment and install dependencies:

pip install torch pennylane scikit-learn pandas matplotlib shap cryptography

Configuration

In the notebook, choose the dataset by setting:

# 1 = Breast Cancer, 2 = Drug-Induced Autoimmunity
DATASET = 1

The number of qubits (n_qubits) adjusts automatically based on the chosen dataset along with number of other internal parameters which adjust based on the differing dimensionality and size of the two datasets

Usage

  1. Open Hybrid_Model.ipynb in JupyterLab or Jupyter Notebook.
  2. Run cells in order:
    1. Data preprocessing
    2. Circuit & model definitions
    3. Training & evaluation
    4. Explainability, adversarial analysis, counterfactuals
    5. Human-in-the-loop hooks & governance logging

Model Architecture

ClassicalOnly

A three-layer feedforward PyTorch network.

QuantumOnly

Angle embedding → PennyLane TorchLayer with entanglers → linear readout.

FullHybridModel

Classical feature extractor → quantum state regressor → skip-connection to final head.

Key Features

  • SHAP Interpretability
    Visualize feature contributions via SHAP.
  • Adversarial Bounds
    Compute trace-distance bounds; plot robustness vs. perturbation.
  • Counterfactual Generation
    Gradient-based minimal perturbations to flip predictions.
  • Human-in-the-Loop
    Prompts for user approval or override of model outputs.
  • Encryption & Governance
    CSV encryption utilities and JSON metadata logging for audits.

Results

On Dataset 1, the hybrid model achieved an ~2 percentage-point improvement in test accuracy over the classical baseline. Detailed metrics (precision, recall, F1), confusion matrices, and plots are provided in the notebook.

References

Contributors (CMU Quantum Enthusiasts): Viraj Shah (virajs@andrew.cmu.edu) Kamya Singh (kamyas@andrew.cmu.edu) Mohammed Rajkotwala (mrajkotw@andrew.cmu.edu)

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages