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
  • Pure NumPy Implementation — no external ML frameworks / Dependencies

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.1.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.1-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: quarknet-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 ae23d9611a7a9d3ffbe0eba38cb42376e8650ae53b43ec9367e02d09dd42d8e1
MD5 6915c1454d4ebb4f4d2ccf5ce3381a7e
BLAKE2b-256 556e723e7888d7be89c41e900032d119a6aa4849b8b54eb06545832d6574082c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: quarknet-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 10.3 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d8bb84a62d8f9bf1153d0ef5caf7ccae840ff143942c82504ac02b3e410245a1
MD5 6f51ced23b5e50fb58d8b1bbc80c21be
BLAKE2b-256 542017e3ff999d6f93c16a55c6c7c1eff3c1fbd0318cebcbeac4499067f8df13

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