Skip to main content

NeuralFabric

A from-scratch machine learning framework built from first principles.

NeuralFabric is an open-source machine learning framework that explores the foundations of modern ML by implementing core components from scratch. It starts at the tensor level and builds upward through automatic differentiation, classical machine learning, and eventually deep learning.

Understand the fundamentals. Build the system. Learn by implementing.

Features

  • NumPy-based Tensor Engine
  • Automatic Differentiation
  • Linear Regression
  • Logistic Regression
  • Train-Test Split
  • Type checking with MyPy
  • Testing with Pytest
  • Code quality with Ruff
  • GitHub Actions CI/CD
  • Modern Python packaging
  • PyPI distribution

Installation

Install NeuralFabric from PyPI:

pip install neuralfabric

For development:

git clone https://github.com/your-username/neuralfabric.git
cd neuralfabric
pip install -e ".[dev]"

Quick Start

from neuralfabric.core.tensor import Tensor
from neuralfabric.linear_model import LinearRegression
from neuralfabric.model_selection import train_test_split

X = Tensor([
    [800, 2],
    [1000, 2],
    [1200, 3],
    [1500, 3],
    [1800, 4],
    [2000, 4],
    [2200, 5],
    [2500, 5],
])

y = Tensor([
    [120000],
    [150000],
    [180000],
    [220000],
    [260000],
    [290000],
    [320000],
    [370000],
])

X_train, X_test, y_train, y_test = train_test_split(
    X,
    y,
    test_size=0.25,
    random_state=42,
)

model = LinearRegression(
    lr=1e-8,
    epochs=10000,
)

model.fit(X_train, y_train)

predictions = model.predict(X_test)

print("Predictions:")
print(predictions.data)

print("\nR² Score:")
print(model.score(X_test, y_test))

Available Models

Category Model
Regression LinearRegression
Classification LogisticRegression

Project Structure

src/
└── neuralfabric/
    ├── core/
    │   ├── tensor.py
    │   └── autograd.py
    ├── linear_model/
    │   ├── linear_regression.py
    │   └── logistic_regression.py
    └── model_selection/
        └── train_test_split.py

Roadmap

Completed

  • Tensor Engine
  • Automatic Differentiation
  • Linear Regression
  • Logistic Regression
  • Train-Test Split
  • Testing
  • CI/CD
  • PyPI Publishing

Planned

  • Neural Network API
  • Optimizers and Loss Functions
  • Metrics and Model Serialization
  • Dataset and DataLoader API
  • Decision Trees and Random Forests
  • K-Means and PCA
  • Documentation and Examples
  • Benchmark Suite

Development

make dev
make test
make lint
make format
make build

Contributing

Contributions are welcome.

Whether you want to fix a bug, improve documentation, add tests, or build a new component, feel free to open an issue or submit a pull request.

  1. Fork the repository.
  2. Create a feature branch.
  3. Make your changes.
  4. Add or update tests.
  5. Commit your changes.
  6. Open a pull request.

License

NeuralFabric is licensed under the MIT License.

See the LICENSE file for details.

Metadata

Release files for neuralfabric 1.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for neuralfabric 1.1.2
File Size Uploaded
neuralfabric-1.1.2.tar.gz 16.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for neuralfabric 1.1.2
File Interpreter ABI Platform
neuralfabric-1.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 44.7 kB

Release files / neuralfabric-1.1.2.tar.gz

Download URL neuralfabric-1.1.2.tar.gz
Size 16.8 kB
Tags Source
SHA-256 checksum
How to use checksums
c5718456308ceef307e669cf2a402daac72fb88019e0e9cb23cb59577a2eef6e
BLAKE2b-256 checksum
How to use checksums
659f674e1051c0ee71c35b4af7ee329f41fd3028ccd6e332016c2c323d79d83a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 16, 2026.

Transparency log

Release files / neuralfabric-1.1.2-py3-none-any.whl

Download URL neuralfabric-1.1.2-py3-none-any.whl
Size 27.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e376889cfc13a0a1fe9b426e29ca5c2a38f2907426b9bedb13fad067cadaaf5d
BLAKE2b-256 checksum
How to use checksums
9e828f98b92d9d3affb79ca0d3bb8706f6e50ed6293887813e16bc48d3991e0e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 16, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.1.2 This release

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page