📘 math4ml — A Lightweight Math & Stats Library for Machine Learning
math4ml is a modular, NumPy-backed Python library designed to teach, visualize, and compute the mathematics behind AI & Machine Learning.
It combines:
- Linear algebra
- Statistics
- Probability
- Hypothesis testing
- Preprocessing
- Visualizations
- Educational examples
with NumPy speed, Numba optimizations, and Khan-Academy–style explanations.
🚀 Features
1. Linear Algebra
- Matrix operations:
matmul,add,subtract,transpose,inverse,det, … - Vector operations:
dot,norm,angle,projection, … - Decompositions: LU, QR, SVD (optional upgrade)
- Interactive visualizations for matrix multiplication, dot products, transformations, etc.
2. Statistics
- Descriptive stats:
mean,var,std,median,range - Correlation: Pearson, Spearman
- Distributions: normal, binomial, uniform, Poisson
- Hypothesis tests:
- t-test
- chi-square test
- ANOVA
- z-test
- non-parametric tests (coming soon)
3. Probability
- PMF, PDF, CDF utilities
- Combinatorics:
nCr,nPr - Bayes theorem helpers
- Random variable simulation utilities
4. Preprocessing
- Scaling:
- StandardScaler
- MinMaxScaler
- MaxAbsScaler
- RobustScaler
- Encoding:
- One-hot
- Label
- Binary
- Feature engineering helpers
5.optimization
6.ml_models
-classification_models -"LogisticRegression", -"NaiveBayes", -"KNN" -linear_models -"LinearRegression", -"RidgeRegression", -"LassoRegression" -metrics -"RegressionMetrics", -"ClassificationMetrics" -validation -"CrossValidation"
7. Educational Tools
Every function includes:
- 🧮 Mathematical formula
- 📘 Concept explanation
- 🔍 Assumptions
- ✏️ Step-by-step example
- 📓 Jupyter notebook tutorials
Perfect for students learning ML math, data scientists, and AI researchers.
📦 Installation
PyPI
pip install math4ml
**🧠 Quickstart Example**
just use print(math4ml.linalg.__doc__), print(math4ml.__doc__) or help(math4ml)
from math4ml.linalg import matmul
from math4ml.stats import t_test
print(matmul([[1, 2]], [[3], [4]]))
stat, p = t_test([1,2,3], [3,4,5])
print("T-stat:", stat, "P-value:", p)
📚 Tutorials
🔍 Explore: https://github.com/SANJAYRAM-DS/math4ml.tutorials.git
Contains:
-Linear algebra examples
-Statistical tests
-Probability examples
-Preprocessing tutorials
-optimization
-ml_models
🤝 Contributing
We welcome contributions from everyone!
You can help by:
-🐛 Reporting issues
-🌟 Suggesting features
-📘 Improving documentation
-🧪 Adding tests
-🧩 Adding examples
-🔧 Submitting pull requests
📝 License
MIT License — free for commercial, educational, and research use.
Metadata
Release files for math4ml 0.1.5
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 |
|---|---|---|---|---|
| math4ml-0.1.5.tar.gz | 31.8 kB | Without provenance | Details for math4ml-0.1.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| math4ml-0.1.5-py3-none-any.whl | Python 3 | none | any | Details for math4ml-0.1.5-py3-none-any.whl |
Total release size: 77.3 kB
Release files / math4ml-0.1.5.tar.gz
| Download URL | math4ml-0.1.5.tar.gz |
|---|---|
| Size | 31.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
68dd72e87479acc408545e1608c3625b87a636779ba1c0aee214dec306c4aa1f
|
|
BLAKE2b-256 checksum How to use checksums |
b7192101e90831bccf513fbbd3c3411f4570f3212496f4d701542f045b311bf0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|
Release files / math4ml-0.1.5-py3-none-any.whl
| Download URL | math4ml-0.1.5-py3-none-any.whl |
|---|---|
| Size | 45.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d28319de0da86a86c8f21b671fadfd6dce6f97815264b11d3f8ada4f071b737e
|
|
BLAKE2b-256 checksum How to use checksums |
8df500dbb0f4ac95f1d81642834a1e583a1e8c72dcd520b75340710151670e17
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|
Security for math4ml 0.1.5
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.