myml-regression
A custom machine learning regression package built from scratch without Scikit-learn.
Features
| Module | Functions / Classes |
|---|---|
| Regression | OLSRegression, RidgeRegression, LassoRegression |
| Preprocessing | fill_missing_mean, fill_missing_mean_df, normalize_features, add_intercept, detect_outliers_zscore |
| Feature Selection | forward_selection, backward_elimination |
| Diagnostics | normality_test (Shapiro-Wilk), vif (Variance Inflation Factor), heteroscedasticity |
| Visualization | plot_actual_vs_predicted, residual_plot |
| Prediction | predict_values |
Installation
From PyPI (once published)
pip install myml-regression
From source
git clone https://github.com/yourusername/myml-regression.git
cd myml-regression
pip install .
From local wheel
pip install dist/myml_regression-0.1.0-py3-none-any.whl
Quick Start
import numpy as np
from myml.preprocessing import add_intercept, normalize_features, fill_missing_mean
from myml.regression import OLSRegression, RidgeRegression, LassoRegression
from myml.feature_selection import forward_selection
from myml.diagnostics import normality_test, vif
# --- Sample data ---
X = np.array([[1, 2], [3, 4], [5, 6], [7, 8]], dtype=float)
y = np.array([1.5, 3.5, 5.5, 7.5])
# Preprocessing
X_norm = normalize_features(X)
X_int = add_intercept(X_norm)
# OLS Regression
ols = OLSRegression()
ols.fit(X_int, y)
print("OLS predictions:", ols.predict(X_int))
# Ridge Regression
ridge = RidgeRegression(alpha=0.5)
ridge.fit(X_int, y)
print("Ridge predictions:", ridge.predict(X_int))
# Lasso Regression
lasso = LassoRegression(alpha=0.01, iterations=1000)
lasso.fit(X_int, y)
print("Lasso predictions:", lasso.predict(X_int))
# Diagnostics
residuals = y - ols.predict(X_int)
stat, p = normality_test(residuals)
print(f"Shapiro-Wilk p-value: {p:.4f}")
vif_scores = vif(X_int)
print("VIF scores:", vif_scores)
Dependencies
numpy >= 1.21pandas >= 1.3matplotlib >= 3.4scipy >= 1.7
Publishing to PyPI
# Install build tools
pip install build twine
# Build distributions
python -m build
# Upload to TestPyPI first
twine upload --repository testpypi dist/*
# Upload to PyPI
twine upload dist/*
Project Structure
myml_package/
├── myml/
│ ├── __init__.py
│ ├── regression.py # OLS, Ridge, Lasso
│ ├── preprocessing.py # Missing values, normalization, outliers
│ ├── feature_selection.py # Forward selection, backward elimination
│ ├── diagnostics.py # Shapiro-Wilk, VIF, heteroscedasticity
│ ├── visualization.py # Actual vs Predicted, Residual plot
│ └── prediction.py # predict_values helper
├── tests/
│ └── test_myml.py
├── pyproject.toml
├── setup.py
├── setup.cfg
├── MANIFEST.in
├── LICENSE
└── README.md
License
MIT
Metadata
Release files for myml-regression 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| myml_regression-0.1.0.tar.gz | 6.6 kB | Without provenance | Details for myml_regression-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| myml_regression-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for myml_regression-0.1.0-py3-none-any.whl |
Total release size: 13.5 kB
Release files / myml_regression-0.1.0.tar.gz
| Download URL | myml_regression-0.1.0.tar.gz |
|---|---|
| Size | 6.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dcb0cea99596c2c0a9bca612132e2b257f64e1bb64dcf7f24412b92a03703ea7
|
|
BLAKE2b-256 checksum How to use checksums |
c56d552c4e72a2b6f09f0af7cb87f423293c6a55c5c7ba1aa4676468706a760e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.9
|
Release files / myml_regression-0.1.0-py3-none-any.whl
| Download URL | myml_regression-0.1.0-py3-none-any.whl |
|---|---|
| Size | 6.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
85788d70d4a285e364f3679a54e348d8cd8ac17694be3b5d51a49363b82b9d7c
|
|
BLAKE2b-256 checksum How to use checksums |
e53f0b845893a0884e4ba450563275d18f0776290319907c6207f3c0d9fd7e2e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.9
|
Security for myml-regression 0.1.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.