Skip to main content

QNN is a Python package for Quantum Neural Networks, a hybrid model combining Quantum Computing and Neural Networks. It was developed by GokulRaj S for research on Customized Quantum Neural Networks.

Project description

GQNN: A Python Package for Quantum Neural Networks

PyPI Downloads PyPI Downloads PyPI Downloads

GQNN is a pioneering Python library designed for research and experimentation with Quantum Neural Networks (QNNs). By integrating principles of quantum computing with classical neural network architectures, GQNN enables researchers to explore hybrid models that leverage the computational advantages of quantum systems. This library was developed by GokulRaj S as part of his research on Customized Quantum Neural Networks.


Table of Contents

  1. Introduction
  2. Features
  3. Installation
  4. Getting Started
  5. Use Cases
  6. Documentation
  7. Requirements
  8. Contribution
  9. License
  10. Acknowledgements
  11. Contact

Introduction

Quantum Neural Networks (QNNs) are an emerging field of study combining the principles of quantum mechanics with artificial intelligence. The GQNN package offers a platform to implement and study hybrid quantum-classical neural networks, aiming to bridge the gap between theoretical quantum algorithms and practical machine learning applications.

This package allows you to:

  • Experiment with QNN architectures.
  • Train models on classical or quantum data.
  • Explore quantum-enhanced learning algorithms.
  • Conduct research in Quantum Machine Learning.

Features

  • Hybrid Neural Networks: Combines classical and quantum layers seamlessly.
  • Custom Quantum Circuits: Design and implement your own quantum gates and circuits.
  • Lightweight and Flexible: Built with Python, NumPy, and scikit-learn for simplicity and extensibility.
  • Scalable: Easily scale models for larger qubit configurations or datasets.
  • Research-Oriented: Ideal for academic and experimental use in quantum machine learning.

Installation

Prerequisites

  • Python 3.7 or higher
  • Ensure pip is updated: pip install --upgrade pip

Installing GQNN

From PyPI

pip install GQNN

From Source

git clone https://github.com/gokulraj0906/GQNN.git
cd GQNN
pip install .

Getting Started

Basic Example

from GQNN.data.dataset import Data_Read
from GQNN.models.data_split import DataSplitter
from GQNN.models.Linear_model import QuantumClassifier_EstimatorQNN
import numpy as np

# Path to the dataset
data_dir = 'Employee_Salary_Dataset.csv'

# Read and preprocess the dataset
df = Data_Read.Read_csv(data_dir)
print("Original DataFrame (after reading and cleaning):")
print(df.head())

# Apply one-hot encoding to string columns
df_with_encoded_columns = Data_Read.convert_strings_to_numeric()
print("\nDataFrame after One-Hot Encoding of string columns:")
print(df_with_encoded_columns.head())

# Scale the dataset using Min-Max Scaling
scaled_df = Data_Read.Scale_data(method='minmax')
print("\nScaled DataFrame (using Min-Max Scaling):")
print(scaled_df.head())

# Split the dataset into features and target
x = df_with_encoded_columns.drop('Gender_Male', axis=1)
y = df_with_encoded_columns['Gender_Male'].astype(int)

# Split the data into training and testing sets
split = DataSplitter(x, y, test_size=0.75, shuffle=True, random_state=43)
x_train, x_test, y_train, y_test = split.split()

# Convert data to NumPy arrays for processing
x_train = np.array(x_train)
y_train = np.array(y_train)

# Initialize and train the Quantum Neural Network model
model = QuantumClassifier_EstimatorQNN(num_qubits=4, maxiter=60, random_seed=143)
model.fit(x_train, y_train)

# Print the trained model's parameters
model.print_model()

# Evaluate the model and compute accuracy
score = model.score(x_test, y_test)
adjusted_score = 1 - score
print(f"Model accuracy (adjusted): {adjusted_score * 100:.2f}%")

Advanced Usage

For more advanced configurations, such as custom quantum gates or layers, refer to the Documentation.


Use Cases

GQNN can be used for:

  1. Research and Development: Experiment with quantum-enhanced machine learning algorithms.
  2. Education: Learn and teach quantum computing principles via QNNs.
  3. Prototyping: Develop proof-of-concept models for quantum computing applications.
  4. Hybrid Systems: Integrate classical and quantum systems for real-world data processing.

Documentation

Comprehensive documentation is available to help you get started with GQNN, including tutorials, API references, and implementation guides.


Requirements

The following dependencies are required to use GQNN:

  • Python >= 3.7
  • NumPy
  • Pandas
  • scikit-learn
  • Qiskit
  • Qiskit-machine-learning
  • Qiskit_ibm_runtime
  • matplotlib
  • ipython
  • pylatexenc

For Linux Users

pip install GQNN[linux]

Optional:

  • Quantum simulation tools (e.g., Qiskit or Cirq) for advanced quantum operations.

Install required dependencies using:

pip install GQNN

Contribution

We welcome contributions to make GQNN better! Here's how you can contribute:

  1. Fork the Repository: Click the "Fork" button on the GitHub page.
  2. Clone Your Fork:
    git clone https://github.com/gokulraj0906/GQNN.git
    
  3. Create a New Branch:
    git checkout -b feature-name
    
  4. Make Your Changes: Implement your feature or bug fix.
  5. Push Changes:
    git push origin feature-name
    
  6. Submit a Pull Request: Open a pull request with a detailed description of your changes.

License

GQNN is licensed under the MIT License. See the LICENSE file for full details.


Acknowledgements

  • This package is a result of research work by GokulRaj S.
  • Special thanks to the open-source community and the developers of foundational quantum computing tools.
  • Inspired by emerging trends in Quantum Machine Learning.

Contact

For queries, feedback, or collaboration opportunities, please reach out:

Author: GokulRaj S
Email: gokulsenthil0906@gmail.com
GitHub: gokulraj0906
LinkedIn: Gokul Raj


Happy Quantum Computing! 🚀

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

GQNN-1.0.1.tar.gz (16.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

GQNN-1.0.1-py3-none-any.whl (20.3 kB view details)

Uploaded Python 3

File details

Details for the file GQNN-1.0.1.tar.gz.

File metadata

  • Download URL: GQNN-1.0.1.tar.gz
  • Upload date:
  • Size: 16.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.11

File hashes

Hashes for GQNN-1.0.1.tar.gz
Algorithm Hash digest
SHA256 e92fa8f9798ae341a79f2a15f1b64bc3dd463d763cc5f9be023d19c6e1da13c4
MD5 35fd52f2c6502df303cd473d9ced15d9
BLAKE2b-256 c6ddbc2ece4663d23efe02429f65dc7e9c42c9470783de8b8fe8b979bf083ffa

See more details on using hashes here.

File details

Details for the file GQNN-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: GQNN-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 20.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.11

File hashes

Hashes for GQNN-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4162f482b38659a5901a998e3475629c09583ce231abe6c7cd51d15b8302988d
MD5 ada71800e6597b4868771402798b2dda
BLAKE2b-256 1b7a01a9753d10d82547c74ec551f98e58277c52c35dbea969a1e3705d8cd2c1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page