Skip to main content

ml_package

A custom machine learning library built from scratch — no sklearn dependency for core algorithms.

Algorithms Included

Module Classes
linear_models LinearRegression (OLS), Ridge (L2), Lasso (L1), ForwardSelection, BackwardElimination
decomposition PCA
neighbors KNNClassifier (city-block distance)
neural_network NeuralNetwork, Perceptron
preprocessing StandardScaler, MinMaxScaler, SimpleImputer, OutlierHandler, LabelEncoder, OneHotEncoder, Normalizer
metrics r2_score, rmse, mae, accuracy_score, confusion_matrix, f1_score
model_selection train_test_split
pipeline Pipeline

Install

pip install -e .

Quick Start

import numpy as np
from ml_package.linear_models.linear_regression import LinearRegression
from ml_package.metrics.regression import r2_score

X = np.random.randn(100, 3)
y = 3*X[:,0] + 2*X[:,1] + np.random.randn(100)*0.5

model = LinearRegression()
model.fit(X, y)
print(r2_score(y, model.predict(X)))

# Check all assumptions
model.check_normality()
model.check_multicollinearity()
model.check_heteroscedasticity()
model.plot_diagnostics()
from ml_package.decomposition.pca import PCA

pca = PCA(n_components=2)
X_pca = pca.fit_transform(X)
pca.plot_components(X)
from ml_package.neighbors.knn_classifier import KNNClassifier

knn = KNNClassifier(k=3, metric="cityblock")
knn.fit(X_train, y_train)
preds = knn.predict(X_test)
from ml_package.neural_network.neural_network import NeuralNetwork
from ml_package.neural_network.perceptron import Perceptron

nn = NeuralNetwork(hidden_size=8, learning_rate=0.05, max_iter=1000)
nn.fit(X, y)

p = Perceptron(learning_rate=0.1, max_iter=200)
p.fit(X, y)

Run Tests

cd tests
python test_linear_regression.py
python test_pca.py
python test_knn.py
python test_neural_network.py

License

MIT

Metadata

Release files for shilpa-j-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 shilpa-j-ml-package 1.0.0
File Size Uploaded Provenance Actions
shilpa_j_ml_package-1.0.0.tar.gz 18.6 kB Without provenance Details for shilpa_j_ml_package-1.0.0.tar.gz

Built distribution (wheel)

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

Total release size: 45.2 kB

Release files / shilpa_j_ml_package-1.0.0.tar.gz

Download URL shilpa_j_ml_package-1.0.0.tar.gz
Size 18.6 kB
Tags Source
SHA-256 checksum
How to use checksums
0eeee1f0cd28826e1ac5b9434e1a8bd49425e430b38bad01be295d0bf3c77f2e
BLAKE2b-256 checksum
How to use checksums
f265b6392268a9e0a82c02c1ae2d5211df85123a6123e4504070d8d08dc4e448
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

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

Download URL shilpa_j_ml_package-1.0.0-py3-none-any.whl
Size 26.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7a495a41e0e3e8c4e57962d44dfaeeadde3d4f763baee79d4c6e811536bea644
BLAKE2b-256 checksum
How to use checksums
7b0b7c3d4a73b27fa2547b6f3df4cfd1c61599dfeb771a4b83ccd067f8c33a62
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Security for shilpa-j-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