Skip to main content

QuarkNet is a lightweight Deep learning library that's built entirely with NumPy and supports the essentials needed to train fully-connected feedforward neural networks.

Project description

QuarkNet ⚡

A minimal deep learning library built from scratch with just NumPy.

QuarkNet is a lightweight Deep learning library that's built entirely with NumPy and supports the essentials needed to train fully-connected feedforward neural networks.

🔸 Features

  • Fully Connected Linear Layers (Linear)
  • Activation Functions: Tanh, ReLU, Sigmoid
  • Loss Functions: Mean Squared Error (MSE)
  • Optimizer: Stochastic Gradient Descent (SGD)
  • Mini-batch Training with shuffling
  • Layer Stacking API for building networks
  • Prediction & Evaluation support

🚀 Installation

Create a virtual environment using uv

uv venv .venv

Activate the virtual environment

source .venv/bin/activate

Install QuarkNet into your isolated .venv virtual environment

uv pip install quarknet

Alternatively, if you prefer traditional tools

python3 -m venv .venv      # Create a virtual environment
source .venv/bin/activate
pip install QuarkNet        # Standard pip install

Solving the XOR Problem with QuarkNet ⚡

The XOR (exclusive OR) problem is a classic example in neural networks because it is non-linear and cannot be solved by a single linear layer.

import numpy as np
from quarknet.nn import NeuralNet
from quarknet.layers import Linear
from quarknet.activations import Tanh
from quarknet.loss import MSE
from quarknet.optim import SGD

# XOR inputs
inputs = np.array([
    [0, 0],
    [0, 1],
    [1, 0],
    [1, 1]
])

# XOR outputs
targets = np.array([
    [0],
    [1], 
    [1],
    [0],
])

# Train the model
model.train(
    inputs=inputs,
    targets=targets,
    loss=MSE(),
    optimizer=SGD(),
    epochs=5000,
    batch_size=32,
    shuffle=True
)

# Make predictions
predictions = model.predict(inputs)
print("Predictions:\n", np.round(predictions))

Output

Predictions:
array(
    [
        [0.],
        [1.],
        [1.],
        [0.],
    ]
)

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

quarknet-0.1.2.tar.gz (9.4 kB view details)

Uploaded Source

Built Distribution

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

quarknet-0.1.2-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file quarknet-0.1.2.tar.gz.

File metadata

  • Download URL: quarknet-0.1.2.tar.gz
  • Upload date:
  • Size: 9.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for quarknet-0.1.2.tar.gz
Algorithm Hash digest
SHA256 a6c686c7040f323baf3b3acc1b262b0f8db079cd28b55dd69e7e8f94f6dda796
MD5 5b5ccc0c4a4ba8b404539e6f0239ed57
BLAKE2b-256 3b726d090d7e2cd7cb8e834a9704132b7814414bff59ea1f1aa01d3665273583

See more details on using hashes here.

File details

Details for the file quarknet-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: quarknet-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 10.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for quarknet-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 60034c3da8ba8e450deab1a7e9cd85438e8a54b0a5cb18a0ea0677c41d6d2dfc
MD5 52e97eb8663ec02c8e83d222916d3aad
BLAKE2b-256 9c975ae1ba9cce46f4574c2acb5426e9b961c52d2c8c389d827555224118e5d7

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