Skip to main content

A hybrid quantum-classical neural network framework using Kala_Quantum and Kala_Torch

Project description

Kala_NuroNetwork

Kala_NuroNetwork is a hybrid quantum-classical neural network framework that integrates Kala_Quantum and Kala_Torch for advanced machine learning tasks.

Features

  • Quantum Layer: Leverage quantum circuits with Hadamard and CNOT gates for preprocessing.
  • Classical Neural Network: Includes fully connected layers for classical computation.
  • Trainer Class: Train and evaluate models with ease.
  • Large Dataset Support: Handle big data with efficient batching and parallelism.

Installation

pip install Kala_Quantum Kala_Torch torch

Usage

from KalaNeroNetwork import KalaNuroNetwork, KalaNuroTrainer
import torch
import torch.nn as nn
import torch.optim as optim

# Define hyperparameters
input_size = 2
n_qubits = 2
hidden_size = 128
output_size = 2
batch_size = 128
epochs = 10

# Generate synthetic dataset
def generate_large_data(num_samples, input_size):
    data = torch.rand(num_samples, input_size)
    labels = (data.sum(axis=1) > 1.0).long()  # Binary classification based on sum threshold
    return data, labels

num_samples = 10000
data, labels = generate_large_data(num_samples, input_size)
dataset = torch.utils.data.TensorDataset(data, labels)
data_loader = torch.utils.data.DataLoader(dataset, batch_size=batch_size, shuffle=True)

# Initialize model, optimizer, and criterion
model = KalaNuroNetwork(input_size, n_qubits, hidden_size, output_size)
optimizer = optim.Adam(model.parameters(), lr=0.001)
criterion = nn.CrossEntropyLoss()

# Train and evaluate
trainer = KalaNuroTrainer(model, optimizer, criterion, device="cpu")

print("Starting training...")
trainer.train(data_loader, epochs)

print("Evaluating model...")
trainer.evaluate(data_loader)

License

This project is licensed under the MIT License. See the LICENSE file for details.

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

kala_nuronetwork-0.1.0.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

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

Kala_NuroNetwork-0.1.0-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file kala_nuronetwork-0.1.0.tar.gz.

File metadata

  • Download URL: kala_nuronetwork-0.1.0.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for kala_nuronetwork-0.1.0.tar.gz
Algorithm Hash digest
SHA256 13f303b214a69bc71708a70bf7dd4185c5133311969556c13c67fe4b8baa7dea
MD5 f3fac5d7d0a953d43c4c5dab0a446eb3
BLAKE2b-256 6d6d1bd5f5955811233a199ce21914a5959494db190e0c80adeea1a8be1ebaaf

See more details on using hashes here.

File details

Details for the file Kala_NuroNetwork-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for Kala_NuroNetwork-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 49028c2deb67a202e37e6a248b384c1a201324ca2785b26793ef7e277d902f19
MD5 525a1035cddebfe0f13dc17e6868927e
BLAKE2b-256 fd0668a992250b21c95b8d4de2122975219ad62391e76cf64a1620e943ac0d44

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