This is one of the best massive online open courses (MOOC) on machine learning and is taught by Prof. Andrew NG. However, Prof. NG teaches the course along with MATLAB/Octave and the assignments must be done and submitted in MATLAB/Octave. Do you like the course but not the proprietary MATLAB or the sluggish Octave? Or for any reason, would you rather to use the free GNU R to complete the assignments? This project is your answer.
To view the lecture videos, slides and assignments instructions visit the course website and its wiki page. This repository provides the starter code to solve the assignments in R statistical software; the completed assignments are also available beside each exercise file. Simply follow these steps to complete the assignments:
_solutioninside the same directory of the starter code. For example,
starter/ex1/computeCost.Rhas an associated solution file named
In order to produce similar results and plots to Octave/Matlab, you should install a few packages:
rglpackage is used to produce the 3D scatter plots and surface plots in the exercises.
portStemmerfunction in this package has the same role of the
rasterpackage is used to produce the plot of the bird in exercise 7.
httrpackages are needed for submission.
ginv(generalized inverse) function in
MASSpackage doesn't produce the same result of the Matlab
pinv(pseudo-inverse). I wrote
pinv.Ras the modified version of MASS
ginvto produce the same result of the MATLAB
pinv. For more info see this stackoverflow discussion
lbfgsb3_.R: Certain optimization tasks could only be solved using
lbfgsb3package, yet there are a few bugs in this package. The purpose of
lbfgsb3_.Ris to address these bugs; it is used for exercises 4 and 8. Beware that
fminuncoptimization function in MATLAB takes one function as input and computes cost and gradient simultaneously. However, cost and gradient functions must be supplied into
Before starting to code, install the following packages:
After completing each assignment,
source("submit.r") and then
submit() in your R console.
I submitted the solutions to Coursera for testing and the scores were 100%. Please report any problem with submission here.
A few screenshots of the plots produced in R:
This project is released under MIT to the extent it is original.