Skip to main content

A unified, high-performance Machine Learning Framework with native C++ backends

Project description

MLEngine

PyPI version Python

MLEngine is a unified, high-performance Machine Learning framework tailored for speed and mathematical transparency.

Under the hood, MLEngine acts as a pure Python API routing to highly optimized, custom-built C++ native engines (knn-engine-core and nn-engine-core). By pushing computational bottlenecks—including the entire training loop—down into C++ via pybind11 and Eigen, MLEngine entirely bypasses the Python Global Interpreter Lock (GIL), resulting in execution speeds up to 100x faster than traditional Python-based ML libraries.

Installation

Install the complete suite via PyPI:

pip install ml-engine-core

Modules Overview

Once installed, use the unified mlengine namespace to access both classical and neural sub-modules.

1. mlengine.knn

Powered by knn-engine-core. Features a highly optimized K-Nearest Neighbors classifier with built-in native Principal Component Analysis (PCA) for dimensionality reduction.

import numpy as np
import mlengine as ml

X_train = np.random.rand(100, 64)
y_train = [str(i % 5) for i in range(100)]

# Configure Engine
cfg = ml.knn.KNNConfig()
cfg.k = 3
cfg.variance = 0.95 # Retain 95% variance via native PCA

engine = ml.knn.KNNEngine(cfg)
engine.train(X_train, y_train, scale=True)

predictions = engine.predict_batch(X_train[:5])
print("KNN Predictions:", predictions)

2. mlengine.nn

Powered by nn-engine-core. A multi-layer perceptron framework that executes its full mini-batch gradient descent loop entirely in C++, preventing the Python GIL from interrupting training epochs.

import numpy as np
import mlengine as ml

# Note: MLEngine Neural Nets are hardware-optimized for 32-bit floats
X_train = np.random.rand(100, 4).astype(np.float32)
y_train = np.eye(3)[np.random.choice(3, 100)].astype(np.float32) 
dataloader = ml.nn.DataLoader(X_train, y_train, batch_size=16)

# Build Architecture
class MyModel(ml.nn.Module):
    def __init__(self):
        super().__init__()
        self.fc1 = self.add_module(ml.nn.DenseLayer(4, 16))
        self.relu = self.add_module(ml.nn.ReLULayer())
        self.fc2 = self.add_module(ml.nn.DenseLayer(16, 3))

    def forward(self, tape, x):
        x = self.fc1(tape, x)
        x = self.relu(tape, x)
        return self.fc2(tape, x)

model = MyModel()

# Compile & Train using C++ JIT
optimizer = ml.nn.Adam(learning_rate=0.01)
loss_fn = ml.nn.SoftmaxCrossEntropyLoss()
trainer = ml.nn.JITCompiler(model, optimizer, loss_fn)

# C++ Native Training Loop
trainer.fit(dataloader, epochs=150, verbose=True)

# predict() returns raw logits. Use np.argmax for classification!
logits = model.predict(X_train[:1])
print("Neural Net Logits:", logits)

Architecture & Benchmarks

MLEngine's core philosophy is Native Loop Hoisting. Rather than returning to Python after every matrix operation or epoch step, MLEngine passes pointers to C++ once, executes the entire mathematical pipeline using AVX SIMD vectorization and a zero-allocation flat-memory Autograd graph, and returns only when finished.

In standard academic benchmarks (Iris, MNIST Digits, Olivetti Faces), mlengine.nn consistently achieves up to a 100x speedup over Scikit-Learn while maintaining mathematically identical (or superior) accuracy via Log-Sum-Exp fusion.

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

ml_engine_core-0.1.5.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

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

ml_engine_core-0.1.5-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file ml_engine_core-0.1.5.tar.gz.

File metadata

  • Download URL: ml_engine_core-0.1.5.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ml_engine_core-0.1.5.tar.gz
Algorithm Hash digest
SHA256 f2c120c5a8a3808a0480f4c86d7fdc54bf0115cf70abd6e49d27492966686315
MD5 f0ebb76865f9dbb38e45e20a8aad4985
BLAKE2b-256 770e745e94b7d529b3f623e43c1e3abe41e0e3420e83bd4b6062baf82e679ec0

See more details on using hashes here.

Provenance

The following attestation bundles were made for ml_engine_core-0.1.5.tar.gz:

Publisher: publish.yml on MLEngineProject/MLEngine

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

File details

Details for the file ml_engine_core-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: ml_engine_core-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ml_engine_core-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 71e936d9e82b39726cc80bc786b8e4adab37d8d3f5ef318b3a5c7c86f87ec1fa
MD5 8b85837445198838d8048f405ccdfcf1
BLAKE2b-256 f2cfecbbd00802c7d98b0574aae518bb359c55b08898b298efa921927fe50134

See more details on using hashes here.

Provenance

The following attestation bundles were made for ml_engine_core-0.1.5-py3-none-any.whl:

Publisher: publish.yml on MLEngineProject/MLEngine

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