Skip to main content

ml_package 🧠

A complete machine learning library built from scratch using only NumPy. API follows scikit-learn conventions — fit(), transform(), predict().

Install

pip install veda_ml_package

Package Structure

ml_package/
├── preprocessing/     StandardScaler, MinMaxScaler, Imputers, Outlier, Encoder
├── linear_models/     LinearRegression (OLS), Ridge, Lasso, ForwardSelection, BackwardElimination
├── decomposition/     PCA
├── neighbors/         KNNRegressor, KNNClassifier (Manhattan distance)
├── neural_network/    NeuralNetwork (backpropagation from scratch)
├── metrics/           r2, rmse, mae, mape | accuracy, precision, recall, f1
├── model_selection/   train_test_split, KFoldCV
├── pipeline/          Pipeline (chain steps like sklearn)
└── visualization/     PCA plots, scree chart, biplot

Quick Start

from ml_package.preprocessing   import StandardScaler, MedianImputer
from ml_package.linear_models   import LinearRegression
from ml_package.model_selection import train_test_split
from ml_package.pipeline        import Pipeline
from ml_package                 import metrics

# Full pipeline
pipe = Pipeline([
    ("imputer", MedianImputer()),
    ("scaler",  StandardScaler()),
    ("model",   LinearRegression()),
])
pipe.fit(X_train, y_train)
preds = pipe.predict(X_test)
metrics.r2(y_test, preds)

All Models

LinearRegression — OLS Summary

from ml_package.linear_models import LinearRegression
model = LinearRegression()
model.fit(X_train, y_train)
model.ols_summary(feature_names=["Area", "BHK", "Price/sqft"])
model.predict(X_test)

Ridge & Lasso

from ml_package.linear_models import Ridge, Lasso
Ridge(alpha=1.0).fit(X, y).predict(X_test)
Lasso(alpha=0.01).fit(X, y).predict(X_test)

Forward / Backward Feature Selection

from ml_package.linear_models import ForwardSelection, BackwardElimination
fs = ForwardSelection(); fs.fit(X, y); fs.summary()
be = BackwardElimination(threshold_p=0.05); be.fit(X, y); be.summary()

Check OLS Assumptions

from ml_package.linear_models import check_assumptions
check_assumptions(X, y, model.predict(X), feature_names=["A","B","C"])

KNN

from ml_package.neighbors import KNNRegressor, KNNClassifier
KNNRegressor(k=5, distance="manhattan").fit(X, y).predict(X_test)
KNNClassifier(k=5, weights="distance").fit(X, y).predict(X_test)

Neural Network

from ml_package.neural_network import NeuralNetwork
nn = NeuralNetwork(hidden_layers=(16, 8), learning_rate=0.01, epochs=2000)
nn.fit(X_train, y_train)
nn.predict(X_test)
nn.summary()
nn.plot_loss()

PCA

from ml_package.decomposition import PCA
pca = PCA(n_components=2)
X_reduced = pca.fit_transform(X)
pca.summary()
pca.plot_variance()

Pipeline

from ml_package.pipeline import Pipeline
pipe = Pipeline([
    ("imputer", MedianImputer()),
    ("scaler",  StandardScaler()),
    ("model",   NeuralNetwork(hidden_layers=(16, 8)))
])
pipe.fit(X_train, y_train)
pipe.predict(X_test)
pipe.summary()

Cross-Validation

from ml_package.model_selection import KFoldCV
from ml_package.metrics         import r2
kf = KFoldCV(n_splits=5, random_state=42)
kf.cross_val_score(LinearRegression(), X, y, metric_fn=r2)

Run Tests

pip install pytest
pytest tests/ -v

Upload to PyPI

pip install build twine
python -m build
twine upload dist/*

License

MIT

Metadata

Release files for veda-ml-package 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for veda-ml-package 1.0.0
File Size Uploaded Provenance Actions
veda_ml_package-1.0.0.tar.gz 28.2 kB Without provenance Details for veda_ml_package-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for veda-ml-package 1.0.0
File Interpreter ABI Platform Actions
veda_ml_package-1.0.0-py3-none-any.whl Python 3 none any Details for veda_ml_package-1.0.0-py3-none-any.whl

Total release size: 64.3 kB

Release files / veda_ml_package-1.0.0.tar.gz

Download URL veda_ml_package-1.0.0.tar.gz
Size 28.2 kB
Tags Source
SHA-256 checksum
How to use checksums
f6eca5a2ef18518d48409eb2876942a5b932ad45ef7d5c0364ac3e7e8c2f1e7a
BLAKE2b-256 checksum
How to use checksums
7792be1ecb8927572180e7104eaf31428a8d5a9494553799994292b1408db4ab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.9

Release files / veda_ml_package-1.0.0-py3-none-any.whl

Download URL veda_ml_package-1.0.0-py3-none-any.whl
Size 36.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
190409918d5fe8888ea8ecc5cf0edf4171b7f7dbca003b7eae7caa34c3729f1b
BLAKE2b-256 checksum
How to use checksums
9085bbbd19d84823005e0737b4eb2129bbbcf05d23dc8e1b59a16f2df5899fc2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.9

Security for veda-ml-package 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page