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 aishwarya_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 aishwarya-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 aishwarya-ml-package 1.0.0
File Size Uploaded Provenance Actions
aishwarya_ml_package-1.0.0.tar.gz 28.0 kB Without provenance Details for aishwarya_ml_package-1.0.0.tar.gz

Built distribution (wheel)

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

Total release size: 64.4 kB

Release files / aishwarya_ml_package-1.0.0.tar.gz

Download URL aishwarya_ml_package-1.0.0.tar.gz
Size 28.0 kB
Tags Source
SHA-256 checksum
How to use checksums
75061116df2229c12f45f8b3bb0d4f88fdae9ea8f03e3c495e42dbd676c4f22d
BLAKE2b-256 checksum
How to use checksums
2e0d73c7b00f9fdedf0b1524229b5ddcca007aa6902976cb524847524568ec73
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

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

Download URL aishwarya_ml_package-1.0.0-py3-none-any.whl
Size 36.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2fe5c1bcc3a7f032afacc0ce5da9c74b55899b0ebc84193141852276b9304545
BLAKE2b-256 checksum
How to use checksums
a10e75410a59f0e7e46613f2699bba7eaa67b5f4dfce672f36a7c4545d7c7c42
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Security for aishwarya-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