You are on page 1of 10

Octave Tutorial

Basic operations

Machine Learning
Octave Tutorial
Moving data around

Machine Learning
Octave Tutorial
Computing on data

Machine Learning
Octave Tutorial
Plotting data
Machine Learning
Octave Tutorial
Control statements: for,
while, if statements
Machine Learning
Octave Tutorial
Vectorial implementation

Machine Learning
Vectorization example.

Unvectorized implementation Vectorized implementation


prediction = 0.0; prediction = theta’ * x;
for j = 1:n+1,
prediction = prediction +
theta(j) * x(y)
end;
Vectorization example.

Unvectorized implementation Vectorized implementation


double prediction = 0.0; double prediction
for (int j = 0; j < n; j++) = theta.transpose() * x;
prediction += theta[j] * x[y];
Gradient descent

(for all )
(for all )

You might also like