Skip to main content

A hyper-optimized, lightweight 3-layer neural network engine running on C-speed machine code kernels.

Project description

🐍 Terin

A hyper-optimized, lightweight 3-layer neural network engine running on C-speed machine code kernels via Numba.

Terin strips away the memory bloat and initialization lag of massive corporate AI frameworks. It provides a flat, lightning-fast mathematical execution environment tailored for micro-architectures, edge deployment, and embedded systems.

✨ Features

  • Instant Startup Footprint: Loads in under 0.01 seconds with near-zero idle RAM consumption.
  • Pure Machine-Code Speed: Compiles all training loops directly into raw machine code (LLVM binary) at runtime using Numba.
  • Proprietary Storage Exporter: Features a native serialization mechanism saving optimized models into highly compact .trn files.
  • 100% Vectorized Calculations: Implements forward and backward backpropagation chains entirely across compiled matrix operations with zero raw Python loop overhead.

🛠️ Installation

pip install terin

🚀 Quick Start & Mathematical Validation

Terin is built to reverse-engineer hidden mathematical relationships with absolute precision. Here is how to initialize, train, export, and run a predictive inference loop using a 3-layer network layout (49,142 parameters):

import terin
import numpy as np

# 1. Generate sample training data
# Target rule: Index 0 is multiplied by 2 | Index 1 is subtracted by 1
fake_data = np.random.uniform(-1, 1, size=(100, 20))
fake_targets = np.zeros((100, 2))
fake_targets[:, 0] = fake_data[:, 0] * 2
fake_targets[:, 1] = fake_data[:, 1] - 1

# 2. Instantiate Terin Model Core
model = terin.ml(y=49142)

# 3. Train the model parameters using C-speed backpropagation
print("Training the model...")
model.ter_trn(x=fake_data, y=fake_targets, z=0.001, a=500)

# 4. Save progress natively
model.exprt("terin_model.trn")

# 5. Restore saved parameters into a fresh environment 
new_model = terin.ml(y=49142)
new_model.imprt("terin_model.trn")

# 6. Evaluate unseen data points
new_data_point = np.random.uniform(-1, 1, size=(1, 20))
prediction = new_model.ter_prdct(new_data_point)
print(prediction)

📊 Performance Benchmarks

When tasked with tracking exact linear rules across continuous parameters, Terin matches and evaluates relationships flawlessly down to individual floating-point variances:

==================================================
🧠 THE PUZZLE BREAKDOWN
==================================================
Input 0 (Target is x2):  0.226866
Input 1 (Target is -1): -0.802973
--------------------------------------------------
True Math Answer:       [ 0.453731, -1.802973]
Terin's AI Prediction:  [ 0.453731, -1.802974]
==================================================

📜 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

terin-0.1.0.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

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

terin-0.1.0-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: terin-0.1.0.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for terin-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ea01f075af15b648d02d4764a8568ce8c720e2ae1a476c3b7f383cfd3feddf19
MD5 bf16b1f7beb7cb5fded5bf9cc14d82e5
BLAKE2b-256 f5fe6600692473111443abf88fdce80f18f6067db61317d813a47bb49422a9fe

See more details on using hashes here.

File details

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

File metadata

  • Download URL: terin-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for terin-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9b6e88aeefb32d76c496a59bc57732f6244da364b32db925c6fac938df571a52
MD5 e8cd8b99d86d0f50742991156ee3813f
BLAKE2b-256 e2836863a7821d4216be10e2cb44b811c4ea463eb40832ec13b19ca25de47688

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