Skip to main content

A lightweight math and statistics library for machine learning with educational tutorials and interactive examples.

Project description

📘 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

math4ml-0.1.3.tar.gz (31.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

math4ml-0.1.3-py3-none-any.whl (45.5 kB view details)

Uploaded Python 3

File details

Details for the file math4ml-0.1.3.tar.gz.

File metadata

  • Download URL: math4ml-0.1.3.tar.gz
  • Upload date:
  • Size: 31.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for math4ml-0.1.3.tar.gz
Algorithm Hash digest
SHA256 55da411ad697eccfe78774b60b5eb9c83dd23efbc35eb0af8b975e2d36fecf49
MD5 b4204e6450555ddc5392d12da55c1a8d
BLAKE2b-256 24f07bb9766d6c9c0861af1a5030d5a21eb2e3f45d8e691d8605c79dd64e2b89

See more details on using hashes here.

File details

Details for the file math4ml-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: math4ml-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 45.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for math4ml-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 971fa8f50aa0b717453961afc00330589dd56445a0775614cae43af1377af876
MD5 a24347e2759c95244f92e3c362ef29ec
BLAKE2b-256 646fb3c7bb0fa63f1e87cf8cd6b8ca7fd4e87f710b23d44e8a2031b313495101

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page