Skip to main content

Lightweight from-scratch ML library — neural nets, tree-based models, linear models, and more

Project description

Epicon

A lightweight, from-scratch machine learning library built on NumPy with optional Numba acceleration. Provides a unified API for neural networks and traditional ML models.

Designed to be minimal yet capable — like Flask for ML.

Quick Start

import epicon
from epicon.datasets import load_iris
from epicon.preprocessing import train_test_split
from epicon.metrics import accuracy_score

# Load data
X, y = load_iris(return_X_y=True)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3)

# Train a model
model = epicon.DecisionTreeClassifier(max_depth=5)
model.fit(X_train, y_train)

# Evaluate
y_pred = model.predict(X_test)
print(f"Accuracy: {accuracy_score(y_test, y_pred):.4f}")

What's Included

Neural Networks

  • Layers: Dense, Dropout, Conv1D
  • Activations: ReLU, LeakyReLU, Sigmoid, Softmax, Tanh
  • Losses: MSE, BinaryCrossEntropy, CategoricalCrossEntropy
  • Optimizers: GradientDescent, Momentum, Adam
  • Model — layer-by-layer construction
  • Sequential — Keras-style wrapper with string activations

Traditional ML Models

  • LinearRegression, Ridge, Lasso, LogisticRegression
  • KNeighborsClassifier, KNeighborsRegressor
  • GaussianNB
  • DecisionTreeClassifier, DecisionTreeRegressor
  • RandomForestClassifier, RandomForestRegressor

Utilities

  • Preprocessing: StandardScaler, MinMaxScaler, LabelEncoder, OneHotEncoder, train_test_split
  • Datasets: load_iris, load_mnist, make_classification, make_regression
  • Metrics: accuracy_score, precision_score, recall_score, f1_score, confusion_matrix, mean_squared_error, mean_absolute_error, r2_score

Installation

# Minimal install (NumPy required)
pip install numpy

# Install Epicon from source
pip install -e .

# With Numba (optional, for faster tree/KNN)
pip install numba

Design

  • Consistent API: all models follow fit(X, y) / predict(X).
  • Minimal dependencies: only NumPy is required.
  • Optional acceleration: Numba JIT for tree split search and KNN.
  • Educational: readable, fully documented source code.
  • Tested: 169+ unit tests with pytest.

Examples

See the examples/ directory:

  • example_ml_iris.py — Decision tree on Iris dataset
  • example_ml_binary.py — LogisticRegression with L2 penalty
  • example_ml_forest.py — RandomForestRegressor on synthetic data
  • example_nn_sequential.py — Sequential neural net with Adam on MNIST

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

epicon-0.3.0.tar.gz (45.7 kB view details)

Uploaded Source

Built Distribution

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

epicon-0.3.0-py3-none-any.whl (67.0 kB view details)

Uploaded Python 3

File details

Details for the file epicon-0.3.0.tar.gz.

File metadata

  • Download URL: epicon-0.3.0.tar.gz
  • Upload date:
  • Size: 45.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for epicon-0.3.0.tar.gz
Algorithm Hash digest
SHA256 1e02d632a79ba9b31aa9f5780760ccd829f41929a39065f51c8ec0d0d1506e23
MD5 71d599395cc541030be3cad95144f540
BLAKE2b-256 39771cb03ded58bb821efcc86bb731f63cfd6ec837efa83282f1ddc2f631d4e0

See more details on using hashes here.

Provenance

The following attestation bundles were made for epicon-0.3.0.tar.gz:

Publisher: publish.yml on kebtes/epicon

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file epicon-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: epicon-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 67.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for epicon-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2cf6d939e368fce8409f302d33f40e7e7c2a0b799852859b3d940451024ba928
MD5 dca8a0a1daf0aaf92c7598b2b150ad81
BLAKE2b-256 07d4999b51d3d3b05bff5932d8df24dd82bdc572910b1fc652ce841ffddaac78

See more details on using hashes here.

Provenance

The following attestation bundles were made for epicon-0.3.0-py3-none-any.whl:

Publisher: publish.yml on kebtes/epicon

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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