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.3.4.tar.gz (15.9 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.3.4-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file gqnn-1.3.4.tar.gz.

File metadata

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

File hashes

Hashes for gqnn-1.3.4.tar.gz
Algorithm Hash digest
SHA256 a9fb0991a1827cfd2943cf40d1bc400869ffdf4dbddc606cd71b88faa230ec58
MD5 bc0dd23b532d59a6e9ff3b4927136127
BLAKE2b-256 4b462a1dab531a05351c75b8f96ff81d6384d565a425a091586c0ae2af088b5a

See more details on using hashes here.

File details

Details for the file gqnn-1.3.4-py3-none-any.whl.

File metadata

  • Download URL: gqnn-1.3.4-py3-none-any.whl
  • Upload date:
  • Size: 5.7 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.3.4-py3-none-any.whl
Algorithm Hash digest
SHA256 c83ba9e2074cc215f7d7be5f2b82c9ddac7bcc8cff03fd7e8849ffd18c32e863
MD5 806fe5802ded7d955b02ba68710c30df
BLAKE2b-256 8761c16fb77bd9e961fdea66cca1b4d5e31866484174952ad3037c0c4abdaa10

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