Skip to content

MatheusLevy/Machine-Learning-Scratch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

35 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ€– Machine Learning & Deep Learning from Scratch

A complete and organized repository with Machine Learning and Deep Learning algorithm implementations from scratch, practical projects, and educational notebooks.

πŸ“š Repository Structure

This repository is organized into three main areas:

πŸ”· 1. Machine Learning (Classical Algorithms)

Implementations of fundamental machine learning algorithms.

πŸ“Š Supervised Learning

  • Regression

    • Linear Regression (Gradient Descent & Normal Equation)
    • Locally Weighted Linear Regression
    • Softmax Regression
  • Classification

    • Logistic Regression (Gradient Descent & Newton's Method)
    • Naive Bayes

πŸ” Unsupervised Learning

  • Clustering
    • K-Means (C++ implementation)

🎯 Nearest Neighbors

  • K-Nearest Neighbors (KNN) - C++ implementation

βš™οΈ C++ Implementations

Low-level C++ implementations for optimized performance.


πŸ”· 2. Deep Learning (Neural Networks and Deep Learning)

🧠 Fundamentals

  • Basic neural network implementation
  • Layers: Input, Hidden, Output
  • Neurons and network architecture

πŸ‘οΈ Computer Vision

Classic CNN Architectures:

  • LeNet
  • VGG16
  • GoogLeNet (Inception)
  • ResNet
  • EfficientNet

Practical Projects:

  • Melanoma Classification
  • Skin Cancer Classification
  • FP16 Optimization

OpenCV:

  • Basic tutorials: filters, colors, contours, edge detection
  • Projects: Color detection, Face anonymization
  • Various experiments

Utilities:

  • Data loaders
  • Mean and standard deviation calculation
  • Binary Focal Loss
  • Helper functions

🎨 Generative Models

  • Autoencoders
  • Fully Connected GAN
  • DCGAN (Deep Convolutional GAN)

πŸ’¬ NLP (Natural Language Processing)

Fundamentals:

  • N-grams
  • Data gathering and preprocessing

Sequence Models:

  • RNN (Recurrent Neural Networks)
  • RNN from Scratch
  • LSTM (Long Short-Term Memory)
  • Sequence-to-Sequence
  • Sequence-to-Sequence with Attention

Transformers:

  • Transformers from Scratch
  • GPT-1 from Scratch
  • Transformers for Translation
  • Project: GPT trained on Wikipedia articles

Applications:

  • Spam Classifier (Naive Bayes)
  • Name Generator
  • Datasets and metrics

πŸŽ“ Specialized Techniques

  • Transfer Learning
  • Multi-label Classification
  • Transpose Convolution

πŸ”· 3. Recommendation Systems

  • Popularity-based recommendation system

πŸ“‚ Datasets

All datasets are centralized in the data/ folder:

  • images/: MNIST and other images
  • tabular/: Iris.csv and other tabular datasets

πŸš€ How to Use

Prerequisites

Python:

pip install numpy pandas matplotlib scikit-learn
pip install torch torchvision
pip install tensorflow
pip install opencv-python
pip install nltk

C++ (for native implementations):

  • C++ Compiler (g++, MSVC, etc.)
  • CMake (optional)

Running Notebooks

  1. Install Jupyter:
pip install jupyter notebook
  1. Navigate to desired folder:
cd 2-Deep-Learning/computer_vision/architectures
jupyter notebook

Compiling C++ Code

cd 1-Machine-Learning/cpp_implementations
g++ -std=c++17 -o program main.cpp knn.cpp kmeans.cpp data_handler.cpp
./program

πŸ“– Topics by Area

Classical Machine Learning

  • Linear and Logistic Regression
  • Distance-based algorithms (KNN)
  • Probabilistic models (Naive Bayes)
  • Clustering (K-Means)

Deep Learning - Computer Vision

  • Fundamental CNN architectures
  • Transfer Learning
  • GANs and generative models
  • Medical projects (skin cancer detection)
  • OpenCV and image processing

Deep Learning - NLP

  • Classical language models (N-grams)
  • RNNs and LSTMs
  • Attention Mechanisms
  • Transformers and GPT
  • Practical applications

🎯 Repository Goals

  1. Educational: Didactic implementations from scratch
  2. Practical: Real projects and applications
  3. Organized: Clear structure by topics and subtopics
  4. Complete: From fundamentals to advanced techniques

πŸ› οΈ Technologies Used

  • Languages: Python, C++
  • DL Frameworks: PyTorch, TensorFlow
  • Computer Vision: OpenCV
  • NLP: NLTK, Transformers
  • Data: NumPy, Pandas
  • Visualization: Matplotlib, Seaborn

πŸ“ Detailed Directory Structure

Machine-Learning-Scratch/
β”œβ”€β”€ data/                                      # Centralized datasets
β”‚   β”œβ”€β”€ images/                               # MNIST, etc.
β”‚   └── tabular/                              # CSV files
β”‚
β”œβ”€β”€ 1-Machine-Learning/                        # Classical ML
β”‚   β”œβ”€β”€ supervised/
β”‚   β”‚   β”œβ”€β”€ regression/                       # Regression algorithms
β”‚   β”‚   β”œβ”€β”€ classification/                   # Classification algorithms
β”‚   β”‚   └── examples/                         # Practical examples
β”‚   β”œβ”€β”€ unsupervised/
β”‚   β”‚   β”œβ”€β”€ clustering/                       # K-means
β”‚   β”‚   └── dimensionality_reduction/         # PCA, etc.
β”‚   β”œβ”€β”€ nearest_neighbors/                    # KNN
β”‚   └── cpp_implementations/                  # C++ implementations
β”‚
β”œβ”€β”€ 2-Deep-Learning/                           # Deep Learning
β”‚   β”œβ”€β”€ fundamentals/                         # Basic neural networks
β”‚   β”‚   └── layers/                           # Layer implementations
β”‚   β”œβ”€β”€ computer_vision/
β”‚   β”‚   β”œβ”€β”€ architectures/                    # Classic CNNs
β”‚   β”‚   β”œβ”€β”€ projects/                         # Practical projects
β”‚   β”‚   β”œβ”€β”€ opencv/                           # OpenCV
β”‚   β”‚   └── utils/                            # Utilities
β”‚   β”œβ”€β”€ generative_models/                    # GANs, Autoencoders
β”‚   β”œβ”€β”€ nlp/
β”‚   β”‚   β”œβ”€β”€ fundamentals/                     # N-grams, preprocessing
β”‚   β”‚   β”œβ”€β”€ sequence_models/                  # RNN, LSTM
β”‚   β”‚   β”œβ”€β”€ transformers/                     # Transformers, GPT
β”‚   β”‚   └── applications/                     # Practical projects
β”‚   └── specialized/                          # Specialized techniques
β”‚
β”œβ”€β”€ 3-Recommendation-Systems/                  # Recommendation systems
β”‚
└── README.md                                  # This file

🀝 Contributions

This is a personal study repository, but suggestions and improvements are welcome!


πŸ“„ License

This project is for educational purposes.


πŸ“§ Contact


Last updated: October 2025

About

Machine Learning Codes From Scatch

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages