GlassBoxML
Machine Learning you can actually see.
Overview
GlassBoxML is a theory-first machine learning library built from scratch using pure NumPy.
Unlike traditional libraries that prioritize abstraction and convenience, GlassBoxML emphasizes transparency and understanding. Every model exposes:
what it learns how it learns where it fails
This project bridges the gap between mathematical learning theory and practical implementation.
Philosophy
Most ML libraries behave like black boxes:
model.fit(X, y)
# magic happens
GlassBoxML is different:
model.fit(X, y)
model.loss_history
model.gradients
model.assumptions
model.failure_modes
model.generalization_estimate
You don't just train models — you inspect learning itself.
Goals Implement core ML algorithms from first principles Expose optimization behavior during training Make model assumptions explicit Demonstrate overfitting and generalization Provide educational transparency without sacrificing code quality Non-Goals Competing with high-performance libraries like scikit-learn GPU acceleration Massive algorithm coverage Production deployment pipelines
This is a learning and reasoning library, not a benchmarking tool.
Implemented / Planned Algorithms
Core Models
- Linear Regression
- Logistic Regression
- k‑Nearest Neighbors
- Ridge Regression
- Lasso Regression
- Decision Trees
- Random Forest
- SVM
Optimization
- Batch Gradient Descent
- Stochastic Gradient Descent
- Momentum
Diagnostics
- Loss curves
- Bias–variance indicators
- Overfitting detection
- Condition number warnings
Theory Tools
- Generalization estimates — implemented as
model.generalization_estimate, a lightweight, capacity-vs-sample-size heuristic that works without a held-out validation set - Capacity indicators
- Noise sensitivity analysis
Feature Extraction & Pipelines
- TF-IDF Vectorizer (sparse and dense modes)
- Sparse Random Projection
Pipelinefor chaining preprocessing and models
Example
from glassboxml import LinearRegression
model = LinearRegression()
model.fit(X, y)
print(model.loss_history)
print(model.explain())
print(model.diagnose()) # dataset profile, training error, failure modes, and generalization_estimate
Project Structure
glassboxml/
│
├── core/ # optimizers, model selection, Pipeline, base classes
├── models/ # ML algorithms
├── diagnostics/ # overfitting & model insights
├── datasets/ # synthetic data generators
├── metrics/ # evaluation metrics
├── preprocessing/ # scaling and transformations
├── feature_extraction/ # TF-IDF vectorizer
├── tuning/ # hyperparameter search
└── examples/ # demos & experiments
Installation
From PyPI:
pip install glassboxml
From source:
git clone https://github.com/hogwarts-coder10/GlassBox-ML.git
cd GlassBox-ML
pip install -r requirements.txt
Dependencies are intentionally minimal:
- numpy
- matplotlib
- scipy
Why This Project Exists
Modern ML education often teaches usage before understanding.
This creates developers who can:
train models ❌ but not explain, debug, or trust them ❌
GlassBoxML reverses that:
Understand → Implement → Experiment → Trust
Contributing
This project values clarity over cleverness.
Contributions should:
Prefer readable, math-aligned code Include explanation comments Demonstrate failure cases, not just success
Metadata
Release files for glassboxml 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| glassboxml-0.2.1.tar.gz | 51.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| glassboxml-0.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 114.2 kB
Release files / glassboxml-0.2.1.tar.gz
| Download URL | glassboxml-0.2.1.tar.gz |
|---|---|
| Size | 51.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f322fd4800b7cd86305e70798d06adb33d1cbf95c4487f6658957aee1807e51f
|
|
BLAKE2b-256 checksum How to use checksums |
c2c3e57dd447e97dd910d013313700d43b614da2d010900b5cf7c895f343dab5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.0
|
Release files / glassboxml-0.2.1-py3-none-any.whl
| Download URL | glassboxml-0.2.1-py3-none-any.whl |
|---|---|
| Size | 62.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a703f49586bb8f2913ca60ec3648b1bf4aa62af0be099c7d871ce195052cd206
|
|
BLAKE2b-256 checksum How to use checksums |
effd7e894c49b3ef7ba56a0bdf5a09781ba6decf2f767efe277aa0c3514e253c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.0
|