A collection of four MATLAB machine learning exercises covering regression, text classification, digit recognition, and image classification. Each exercise includes datasets, training scripts, and pre-trained models so results can be reproduced without retraining.
MATLAB R2023a or later with the following toolboxes installed:
| Toolbox | Used In |
|---|---|
| Statistics and Machine Learning Toolbox | Exercises 1, 2 |
| Deep Learning Toolbox | Exercises 3, 4 |
| Image Processing Toolbox | Exercises 3, 4 |
Run check_libraries.m from the repository root to verify your installation.
Implements gradient descent from scratch to fit a polynomial regression surface predicting home sale prices from square footage and year built.
cd Exercise_1_regression
Machine_Learning_1a_home_dataDataset: train.csv (Ames Housing data subset)
Trains a 1000-tree Random Forest on pre-computed text embeddings to classify review sentiment. Includes OOB error visualization during training.
cd Exercise_2_Text_Sentience
Text_sentienceSet trainModel = true on line 7 to retrain from scratch, or leave it false to load the included pre-trained model.
Dataset: train_data.parquet, test_data.parquet
Trains a three-layer pattern recognition network (300-200-100 hidden units) on the MNIST dataset.
cd Exercise_3_Digit_Classification
MNIST_ML_Lab9Set trainModel = true on line 12 to retrain, or leave it false to load the included model.
Dataset: mnist.mat
Trains a ResNet on CIFAR-10 with data augmentation (random reflections, translations) for 80 epochs. Displays a confusion matrix and sample predictions on the validation set.
cd Exercise_4_Image_Classification
CIFAR_10If trainedResidualNetwork.mat is not present, the script will train automatically. Otherwise it loads the saved network.
Dataset: CIFAR-10 batches in data/
.
├── check_libraries.m # Verify required toolboxes
├── Library_Check/
│ └── checkLibrary.m # Alternate toolbox checker
├── Exercise_1_regression/
│ ├── Machine_Learning_1a_home_data.m
│ ├── preprocessAndSplitData.m
│ └── train.csv
├── Exercise_2_Text_Sentience/
│ ├── Text_sentience.m
│ ├── train_data.parquet
│ ├── test_data.parquet
│ └── trainedModel.mat
├── Exercise_3_Digit_Classification/
│ ├── MNIST_ML_Lab9.m
│ ├── mnist.mat
│ └── trainedModel.mat
└── Exercise_4_Image_Classification/
├── CIFAR_10.m
├── loadCIFARData.m
├── trainedResidualNetwork.mat
└── data/
├── batches.meta.mat
├── data_batch_[1-5].mat
└── test_batch.mat
This project is licensed under the MIT License. See LICENSE for details.