Catalog PyPI
PACKAGE EXPLORERView in registry

AffineFlow-ML

PyPI

A high-performance C++ Machine Learning backend for AffineFlow

c++eigenknnmachine-learningpca
Versions collected1
Direct dependencies2From release 0.1.0
Last observed20 Oct, 21:04 UTC

README

Version 0.1.0 documentation

AffineFlow-ML

PyPI version Python Build system Bindings

A high-performance Machine Learning engine for the AffineFlow ecosystem.

Designed for rapid experimentation without the Python Global Interpreter Lock (GIL) overhead, AffineFlow-ML executes compute-intensive tasks strictly in native C++ using Eigen and OpenBLAS. It features a dynamically compiled multi-architecture backend (Generic, AVX2, AVX-512) for maximum hardware-accelerated throughput safely dispatched at runtime.

Highlights

  • Dynamic Hardware Dispatch: Automatically detects your CPU at runtime to dispatch highly optimized AVX2 or AVX-512 instructions.
  • Zero-Copy Buffer Protocol: Uses Eigen::Ref and RowMajor structures to natively ingest NumPy arrays without memory duplication.
  • Advanced KNN Classifier: OpenMP parallelized C++17 implementation with efficient top-k neighbor selection (std::nth_element).
  • Distance Metrics: Native vectorized support for Euclidean, Manhattan, and Cosine distance algorithms.
  • Weighted Voting: Choose between standard uniform voting or distance-weighted predictions.
  • Adaptive PCA: Built-in dimensionality reduction with standard and thin-SVD modes for high-dimensional data.

Installation

Install the released wheel from PyPI:

pip install AffineFlow-ML

Quick Start

import numpy as np
import affineflow_ml as ml

# Example data
X_train = np.random.rand(1000, 50).astype(np.float64)
y_train = ["class_A" if x[0] > 0.5 else "class_B" for x in X_train]

# Configure the engine with new features
cfg = ml.KNNConfig()
cfg.k = 5
cfg.variance = 0.95
cfg.metric = ml.DistanceMetric.COSINE
cfg.weights = ml.Weights.DISTANCE

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

X_test = np.random.rand(10, 50).astype(np.float64)
predictions = engine.predict_batch(X_test)
print(predictions)

Performance Benchmark

AffineFlow-ML achieves strict mathematical parity with Scikit-Learn while delivering up to 5.4x faster inference and transformation pipelines on high-dimensional datasets. Powered by a multithreaded C++17 Eigen backend with dynamic hardware dispatch (AVX2/AVX-512) and OpenMP parallelism, it eliminates Python loop and GIL bottlenecks.

DatasetMetric & WeightsScikit-Learn TimeAffineFlow-ML TimeSpeedupAccuracy
Olivetti Faces (400 samples, 4096 dims $\rightarrow$ PCA 90%)Cosine / Distance0.4134s0.0760s5.44x90.00%
Handwritten Digits (1797 samples, 64 dims $\rightarrow$ PCA 95%)Manhattan / Uniform0.0808s0.0354s2.29x98.61%
Iris Flower (150 samples, 4 dims $\rightarrow$ PCA 99%)Euclidean / Uniform0.0105s0.0055s1.91x100.00%

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 1

Collected releases
VersionPublishedDirect dependenciesOpen version
0.1.05 Aug 20262

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Repository

PENDING
affineflow/affineflow-ml

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 21:04 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:1b1bd0b4b96a3884722df00d40966d6f94bb8da9306dbaa7041a0fb35ac3ebff