Octave cheat sheet for Coursera Machine Learning course

Switching from / to Octave when working with the Coursera machine learning course can be a bit of a hassle, since some of the Octave syntax is special. Here is my own cheat sheet to remember the most important statements required for the exercises.

Matrices

  • , Column separator
  • ; Row separator

Submatrices

  • indexes start with one
  • slices just like in python : a(1,2:3) selects first row, cols 2 and 3

Adding ONES

Adds a column of ones on the left side

  • rows gets number of rows in X
  • ones(rows(X),1) creates a column vector of 1
  • […] combines both

TranspOSE

APPLY Operator ON VECTOR ELEMENTS

Dot operator

do not print result of statement / REDUCE VERBOSE OUTPUT

Append “;” to statement

FOR-LOOP

 

Functions

Neural Networks

Multiplication of layers

Assume calculation of layer with n nodes to m nodes, then \(\Theta \) will be a matrix with m rows and n colums. And the multiplication will be \(a^{(n+1)}=\Theta*a^{(n)}\). The final value will be \(a^{(n+1)}=sigmoid(\Theta*a^{(n)})\)

Sigmoid

which means:

\(1/{1+e^{-z}}\) for each of the vector elements.

 

Ramping Up for the Udacity Self-Driving Car Nanodegree

I was having great fun with the first exercise / graded project of Udacity’s Self-Driving Car Nanodegree (https://de.udacity.com/drive/). The first exercise is the implementation of a (simple) lane detection based on provided still images and video recordings from a dash cam. Having worked with image processing and Python before, I thought it was quite straightforward. It seems however, that some of the participants with less background in the technologies needed more ramp-up (there are several discussions on an Udacity provided slack channel).

Anyone being accepted for the Nanodegree program or planning to apply, might consider to read up on the following topics (no need to deep-dive, though):

Image processing

  • Of course, implementing a lane detection requires the processing of images. The basic knowledge required is to learn about the encoding of images, i.e. RGB representation as well as HSV/HSL representation (in case you want to do some extra processing)

Python

Python is a straightforward scripting language, but it has some peculiarities, that you might not have seen before:

  • Slices : A dedicated syntax for retrieving partial lists/arrays/matrices
  • Assignments: Python supports slices and other things on the left side of an assignment operator
  • Lambda / methods as arguments: Your code will be invoked as callback by passing around methods as parameters.

Git / Github

  • Examples projects / configuration are provided by cloning a repo from Github
  • You can submit your first projects as a zip file or as submitting a link to a Github Repo

Being prepared for this topics will really make the first deadline (1 week) for project submission much easier.