A collection of machine learning and deep learning models implemented from scratch and with minimal dependencies for educational purposes.
This repository focuses on understanding the mathematics, algorithms, and implementation details behind modern AI systems.
This project is designed to:
- Learn machine learning fundamentals deeply
- Implement algorithms from scratch
- Understand neural network mathematics
- Explore optimization and training techniques
- Build intuition for AI systems
- Compare classical ML vs deep learning approaches
machine-learning-models/
│
├── models/
│ ├── machine_learning/
│ │ ├── linear_regression/
│ │ ├── logistic_regression/
│ │ ├── decision_trees/
│ │ ├── svm/
│ │ └── clustering/
│ │
│ └── deep_learning/
│ ├── neural_networks/
│ ├── cnn/
│ ├── rnn/
│ ├── transformers/
│ └── autoencoders/
│
├── datasets/
├── notebooks/
├── docs/
└── README.mdMachine Learning (ML) is a field of artificial intelligence where computers learn patterns from data instead of being explicitly programmed.
Traditional programming:
Rules + Data → AnswersMachine learning:
Data + Answers → RulesML systems improve performance by learning from examples.
The model learns using labeled data.
Examples:
- Image classification
- Spam detection
- Price prediction
- Sentiment analysis
Algorithms:
- Linear Regression
- Logistic Regression
- Support Vector Machines
- Neural Networks
The model finds hidden patterns without labels.
Examples:
- Clustering
- Dimensionality reduction
- Anomaly detection
Algorithms:
- K-Means
- PCA
- DBSCAN
An agent learns by interacting with an environment using rewards and penalties.
Examples:
- Game AI
- Robotics
- Self-driving systems
Deep Learning is a subset of machine learning based on artificial neural networks with multiple layers.
Instead of manually designing features, deep learning models automatically learn representations directly from data.
Deep learning excels at:
- Computer vision
- Natural language processing
- Speech recognition
- Generative AI
- Robotics
Artificial neural networks are inspired by biological neurons.
Basic structure:
Input Layer → Hidden Layers → Output LayerEach neuron performs:
z = Wx + b
a = activation(z)Where:
x= inputsW= weightsb= biasa= output activation
Basic fully connected networks used for classification and regression.
Specialized for image processing.
Used in:
- Object detection
- Image classification
- Medical imaging
Designed for sequential data.
Used in:
- Text generation
- Language modeling
- Time-series forecasting
Modern architecture powering large language models.
Used in:
- ChatGPT
- Translation systems
- Code generation
- Multimodal AI
This repository explores the mathematics behind AI, including:
- Linear algebra
- Calculus
- Probability
- Optimization
- Gradient descent
- Backpropagation
- Information theory
| Category | Model | Status |
|---|---|---|
| Deep Learning | MNIST Logistic Regression | Complete |
| Deep Learning | Fully Connected Neural Network | In Progress |
| Machine Learning | Linear Regression | Planned |
| Machine Learning | Decision Tree | Planned |
| Deep Learning | CNN | Planned |
| Deep Learning | Transformer | Planned |
- Python
- NumPy
- Matplotlib
- Jupyter Notebook
- PyTorch (future)
- TensorFlow (future)
Each project folder contains its own README with setup instructions.
Example:
cd models/deep_learning/neural_networks/stg
uv run python main.pyThis repository prioritizes:
- Simplicity
- Mathematical understanding
- Clean implementations
- Minimal abstractions
- Learning-by-building
Many implementations intentionally avoid high-level frameworks initially to expose the underlying mechanics.
- Implement CNNs from scratch
- Build transformers from scratch
- Explore diffusion models
- Add reinforcement learning agents
- Compare optimizers mathematically
- Create visual training tools
- Benchmark models
- Linear Algebra
- Calculus
- Probability & Statistics
- Classical Machine Learning
- Neural Networks
- Deep Learning
- Transformers
- Generative AI
Books:
- Deep Learning — Ian Goodfellow
- Neural Networks and Deep Learning — Michael Nielsen
- Pattern Recognition and Machine Learning — Christopher Bishop
Courses:
- Andrew Ng Machine Learning
- CS231n Stanford
- fast.ai
MIT License @Stewie-pixel