A foundational linear algebra and ML modeling framework built with educational traceability.
Project description
ML-Lense
Understand Machine Learning — Not Just Use It.
Explainable, interpretable, and educational tooling that reveals how ML really works under the hood.
✨ What is ML-Lense?
ML-Lense is an open-source library that helps you see inside machine learning.
Instead of treating ML as a black box, ML-Lense explains:
- Why a model made a prediction
- How parameters were learned
- What math drives each algorithm
- How features influence outcomes
- What happens during training step-by-step
It is designed for:
- Researchers
- Students
- Engineers
- Educators
- Curious builders
If scikit-learn helps you build models,
ML-Lense helps you understand them.
🧠 Philosophy
Modern ML tooling focuses on:
- Accuracy
- Speed
- Scale
But rarely on:
- Understanding
- Interpretability
- First-principles learning
ML-Lense exists to change that.
ML should be understandable, not mysterious.
🔍 Core Idea
Train any model → Get a deep explanation layer.
from sklearn.linear_model import LinearRegression
from ml_lense import explain
model = LinearRegression().fit(X, y)
report = explain(model, X, y)
report.show()
ML-Lense generates:
- Parameter reasoning
- Mathematical derivations
- Feature importance breakdown
- Training dynamics
- Human-readable explanations
🚀 Features
1️⃣ Parameter Transparency
Understand why weights were chosen.
- Linear models → closed-form math
- Neural nets → gradient dynamics
- Tree models → split logic
2️⃣ Math-Aware Explanations
Every output maps back to math.
- Loss function analysis
- Gradient flow visualization
- Optimization reasoning
- Statistical assumptions
3️⃣ Training Dynamics
See what happens during learning.
- Convergence behavior
- Bias vs variance shifts
- Overfitting detection
- Learning stability
4️⃣ Feature Attribution
Not just importance — causation-aware insights
- Local explanations
- Global influence
- Interaction effects
- Feature sensitivity curves
5️⃣ First-Principles Reports
ML-Lense produces structured outputs:
- Markdown reports
- PDF summaries
- Interactive notebooks
- Teaching-ready visualizations
📚 Supported Domains (Roadmap)
Classical ML
- Linear Regression
- Logistic Regression
- SVM
- kNN
- Decision Trees
- Random Forest
- Gradient Boosting
Deep Learning
- MLPs
- CNNs
- Transformers (planned)
- Attention analysis
Statistics
- Hypothesis testing insights
- t-tests, chi-square reasoning
- Distribution assumptions
- Sampling diagnostics
Time Series
- ARIMA interpretability
- Seasonality decomposition
- Forecast uncertainty analysis
🧪 Example Outputs
ML-Lense produces explanations like:
"Weight w₃ is large because feature variance is high and strongly correlated with the target."
"Model confidence comes from low residual spread across 92% of samples."
"Gradient oscillations indicate suboptimal learning rate."
🎯 Use Cases
🎓 Education
- Learn ML intuitively
- Teach algorithms visually
- Bridge math ↔ implementation
🔬 Research
- Interpret experimental models
- Debug training failures
- Generate explanation reports
🏭 Production ML
- Model debugging
- Stakeholder explainability
- Responsible AI documentation
🆚 How is this different?
| Tool | Focus |
|---|---|
| scikit-learn | Model building |
| SHAP/LIME | Feature attribution |
| TensorBoard | Training metrics |
| ML-Lense | Full-stack understanding |
ML-Lense combines:
- Math
- Training behavior
- Interpretability
- Intuition
In one unified layer.
� Installation
pip install ml-lense
Or development install:
git clone https://github.com/SANJAYRAM-DS/ml-lense
cd ml-lense
pip install -e .
⚡ Quick Start
from ml_lense import explain
from sklearn.datasets import load_diabetes
from sklearn.linear_model import Ridge
X, y = load_diabetes(return_X_y=True)
model = Ridge().fit(X, y)
lens = explain(model, X, y)
lens.summary()
lens.math()
lens.training_dynamics()
lens.feature_story()
📊 Outputs
ML-Lense can generate:
- 📄 Markdown reports
- 📘 Research-ready PDFs
- 📊 Visual dashboards
- 🧠 Math walkthroughs
🧱 Design Principles
- Minimal API
- Model-agnostic
- Math-first
- Research-grade clarity
- Documentation-friendly
🤝 Contributing
We welcome contributors from:
- ML researchers
- Students
- Educators
- Open-source developers
Ways to contribute:
- Add model explainers
- Improve math modules
- Create tutorials
- Expand domains (time series, NLP, CV)
See CONTRIBUTING.md for details.
🌍 Vision
ML-Lense aims to become:
The "NumPy for understanding machine learning."
A universal layer that makes every model:
- Transparent
- Learnable
- Explainable
- Trustworthy
� License
MIT License — use freely in research and industry.
⭐ If you like ML-Lense
- Star the repo
- Share with learners
- Use in teaching
- Contribute ideas
Let's make machine learning understandable.
Built with clarity in mind.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mllense-0.1.1.tar.gz.
File metadata
- Download URL: mllense-0.1.1.tar.gz
- Upload date:
- Size: 77.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b56eb28e9733db6b6fdda07fe2c331b75d16f0a5514655619a96144b328d507c
|
|
| MD5 |
b9f1b3748f8abe14c1fcf0fbebbec855
|
|
| BLAKE2b-256 |
26cd0d907c5335e0103c9fe87551bbb28b10bb6da54f8af17657cfcd42a25e96
|
File details
Details for the file mllense-0.1.1-py3-none-any.whl.
File metadata
- Download URL: mllense-0.1.1-py3-none-any.whl
- Upload date:
- Size: 143.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7069413418854c7d3b3c22d37fd86b9f86550f31f767dea73bd9a7434afc5551
|
|
| MD5 |
2fc453bf85753a2e9c40b622412778e6
|
|
| BLAKE2b-256 |
1941d0a0492af15bc6f8b8dc53128c6cc63145e6dfc5e25e4ebbea240b7eea78
|