Mini machine learning library
Project description
microMlKit
microMlKit is a lightweight, educational machine learning library built with NumPy and a scikit-learn-inspired API.
Package/import name:
micromlkit(lowercase)
Overview
micromlkit is designed for learning, experimentation, and understanding core ML algorithms through readable implementations.
It provides:
- A familiar estimator workflow (
fit,predict,transform) - Reusable base classes and mixins
- Core algorithms across regression, classification, clustering, decomposition, trees, SVM, ensemble, and neighbors
- Preprocessing, metrics, model selection, and pipeline utilities
Installation
Install from PyPI
pip install micromlkit
Install from source (development)
git clone <repository-url>
cd microMlKit
pip install -e .[dev]
Quick Start
Regression with preprocessing + pipeline
import numpy as np
from micromlkit.linear_model import LinearRegression
from micromlkit.metrics import mean_squared_error, r2_score
from micromlkit.model_selection import train_test_split
from micromlkit.pipeline import Pipeline
from micromlkit.preprocessing import StandardScaler
X = np.array([[1.0], [2.0], [3.0], [4.0], [5.0]])
y = np.array([2.0, 4.1, 6.1, 8.0, 10.2])
X_train, X_test, y_train, y_test = train_test_split(
X, y, test_size=0.4, random_state=42
)
model = Pipeline([
("scaler", StandardScaler()),
("regressor", LinearRegression()),
])
model.fit(X_train, y_train)
y_pred = model.predict(X_test)
print("MSE:", mean_squared_error(y_test, y_pred))
print("R2:", r2_score(y_test, y_pred))
Classification example
import numpy as np
from micromlkit.linear_model import LogisticRegression
from micromlkit.metrics import accuracy_score
X = np.array([[0.1], [0.3], [0.6], [0.8]])
y = np.array([0, 0, 1, 1])
clf = LogisticRegression(learning_rate=0.1, n_iterations=2000)
clf.fit(X, y)
pred = clf.predict(X)
print("Accuracy:", accuracy_score(y, pred))
Implemented Modules
| Module | Key Components |
|---|---|
micromlkit.base |
BaseEstimator, BaseModel, BaseTransformer, mixins, BasePipeline |
micromlkit.linear_model |
LinearRegression, Ridge, Lasso, LogisticRegression |
micromlkit.cluster |
KMeans, DBSCAN, AgglomerativeClustering |
micromlkit.tree |
DecisionTreeClassifier, DecisionTreeRegressor |
micromlkit.ensemble |
RandomForestClassifier, RandomForestRegressor, GradientBoostingClassifier, GradientBoostingRegressor |
micromlkit.neighbors |
KNNClassifier, KNNRegressor |
micromlkit.svm |
SVC, SVR |
micromlkit.decomposition |
PCA |
micromlkit.preprocessing |
StandardScaler, SimpleImputer, LabelEncoder |
micromlkit.metrics |
classification + regression metrics |
micromlkit.model_selection |
train_test_split, KFold, StratifiedKFold, cross_val_score, ParameterGrid, GridSearchCV |
micromlkit.pipeline |
Pipeline |
micromlkit.utils |
kernel/math and validation helpers |
Project Scope
- Goal: educational readability and practical experimentation
- Runtime dependency: NumPy
- Python version:
>=3.9 - Production note: this project is intended for learning and small-scale experimentation rather than production-grade ML workloads
Testing
Run the test suite:
pytest -ra
Latest local verification in this repository: 157 passed.
Repository Structure
micromlkit/
├── base.py
├── cluster/
├── decomposition/
├── ensemble/
├── linear_model/
├── metrics/
├── model_selection/
├── neighbors/
├── pipeline/
├── preprocessing/
├── svm/
├── tree/
└── utils/
License
See the LICENSE file in the repository root.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file micromlkit-1.0.0.tar.gz.
File metadata
- Download URL: micromlkit-1.0.0.tar.gz
- Upload date:
- Size: 44.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
31fbe99bdf5c2da6bf1b4e02ee0815a88c4bf49374b956826a0cc3f6f99803f2
|
|
| MD5 |
6b702f2e0cca98dc5f84384b7c53aa62
|
|
| BLAKE2b-256 |
d4849f900ba3f2d0a520349872fd12789a2278c89d5e8cf1ed16e89972e281a0
|
Provenance
The following attestation bundles were made for micromlkit-1.0.0.tar.gz:
Publisher:
pypi_publish.yml on COLLiDER4D/microMlKit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
micromlkit-1.0.0.tar.gz -
Subject digest:
31fbe99bdf5c2da6bf1b4e02ee0815a88c4bf49374b956826a0cc3f6f99803f2 - Sigstore transparency entry: 1237182206
- Sigstore integration time:
-
Permalink:
COLLiDER4D/microMlKit@8abff6f46e9988c01fb1a24113654ed579d7d6d6 -
Branch / Tag:
refs/heads/develop - Owner: https://github.com/COLLiDER4D
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi_publish.yml@8abff6f46e9988c01fb1a24113654ed579d7d6d6 -
Trigger Event:
workflow_run
-
Statement type:
File details
Details for the file micromlkit-1.0.0-py3-none-any.whl.
File metadata
- Download URL: micromlkit-1.0.0-py3-none-any.whl
- Upload date:
- Size: 49.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
585475bcaf7ff6d86fe476d0605559b0c3736fc675dcc490b9715fc16abed58e
|
|
| MD5 |
f5912fed4eadcc0c20a56bf8af595e18
|
|
| BLAKE2b-256 |
f58ffea9e38d49be9bb9a4b2d00778919119ccc01950519503a19cea5b19bb0e
|
Provenance
The following attestation bundles were made for micromlkit-1.0.0-py3-none-any.whl:
Publisher:
pypi_publish.yml on COLLiDER4D/microMlKit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
micromlkit-1.0.0-py3-none-any.whl -
Subject digest:
585475bcaf7ff6d86fe476d0605559b0c3736fc675dcc490b9715fc16abed58e - Sigstore transparency entry: 1237182411
- Sigstore integration time:
-
Permalink:
COLLiDER4D/microMlKit@8abff6f46e9988c01fb1a24113654ed579d7d6d6 -
Branch / Tag:
refs/heads/develop - Owner: https://github.com/COLLiDER4D
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi_publish.yml@8abff6f46e9988c01fb1a24113654ed579d7d6d6 -
Trigger Event:
workflow_run
-
Statement type: