Programming Assignments for Online Machine Learning Class
This repository consists of solutions to the programming assignments in one of the Machine Learning courses I took. The materials presented here should only be used as reference and should not be used in any way that might result in violation of honor code for your class.
All the codes are written in MATLAB. MATLAB Is usually used for prototyping machine learning applications.
I have tried to avoid loops as much as possible and vectorized almost every operation in these assignments. Use this as a guideline to how to write a simple one-line code for carrying out calculations which take a lot of indices tracking when done through loops. Using vectors also makes your code significantly efficient.
Linear regression model to predict housing price.
Logistic regression and classifiers
Multi-class classification and Neural Networks
Neural Network Learning
Regularized Linear Regression and Bias/Variance (Learning Curves)
Support Vector Machines & Spam Classifier
ex6_optional contains code for the optional part of the exercise. For this to work, you need to extract the emails from SpamAssassin Public Corpus into 'spam' and 'non-spam' folders. Then for training and testing run the following:
load('newSpamTrain.mat');
C = 0.03;
model = svmTrain(Xtrain, ytrain, C, @linearKernel);
p = svmPredict(model, Xtrain);
fprintf('Training Accuracy: %f\n', mean(double(p == ytrain)) * 100);
% Load the test dataset
% You will have Xtest, ytest in your environment
load('newSpamTest.mat');
p = svmPredict(model, Xtest);
fprintf('Test Accuracy: %f\n', mean(double(p == ytest)) * 100);
K-mean clustering and Principal Component Analysis Application of K-means to compress my picture into 16 colors
Anomaly Dectection and Recommender System