Machine Learning: Difference between revisions

From Adam Colton
Jump to navigation Jump to search
Line 49: Line 49:
=== Multiple Features ===
=== Multiple Features ===
=== Gradient Descent for Multiple Variables ===
=== Gradient Descent for Multiple Variables ===
* Parameters: &Theta;<sub>0</sub>,&Theta;<sub>1</sub>,...,&Theta;<sub>n</sub>
* Cost Function: J( &Theta;<sub>0</sub>,&Theta;<sub>1</sub>,...,&Theta;<sub>n</sub> ) or simply J(&Theta;)
Much like before, gradient descent is calculated for all &Theta;s before being applied. To make the formula more uniform we set x<sub>0,i</sub> = 1 for all i then the formula becomes
  &Theta;<sub>j</sub> = &Theta;<sub>j</sub> - (&alpha;/m) * &Sigma;<sub>i=1</sub><sup>m</sup> (h(&Theta;, x<sub>i</sub>) - y<sub>i</sub>) * x<sub>i,j</sub>
Note: I may have my notation for rows and columns mixed up in the formula - double check before using.
=== Gradient Descent in Practice 1 - Feature Scaling ===
=== Gradient Descent in Practice 1 - Feature Scaling ===
=== Gradient Descent in Practice 2 - Learning Rate ===
=== Gradient Descent in Practice 2 - Learning Rate ===

Revision as of 16:51, 2 May 2013

Week 1 - Intro

What is Machine Learning

  • Checkers playing computer (Arthur Samuel)

Supervised Learning

Right answer is provided. Types of problems

  • Regression
  • Classification

Unsupervised Learning

The data has no "correct answer"

Cocktail party algorithm

Week 1 - Linear Regression with One variable

Model Representation

Working with housing prices in Portland as our dataset.

Symbols used

  • m - number of training examples
  • x - input variables
  • y - output variable
  • h - hypothesis (function h(x) = y)

Univariate linear regression

Cost Function

hΘ(x) = Θ0 + Θ1x

sum of square error as our cost function. He's using 1/2m rather than 1/m, I'm not sure why.

Cost Function - Intuition : 1

Demo of technique.

Cost Function - Intuition : 2

Contour plots.

Gradient Descent

Θj = Θj - α (d/dΘj) * J(Θ0, Θ1)

Gradient Descent Intuition

Explaining gradient descent.

Gradient Descent for Linear Regression

  • Θ0 = Θ0 - α(1/m) Σm (hΘ(xi) - yi)
  • Θ1 = Θ1 - α(1/m) Σm (hΘ(xi) - yi) * xi

Linear Regression with Multiple Variables - Week 2

Multiple Features

Gradient Descent for Multiple Variables

  • Parameters: Θ0,Θ1,...,Θn
  • Cost Function: J( Θ0,Θ1,...,Θn ) or simply J(Θ)

Much like before, gradient descent is calculated for all Θs before being applied. To make the formula more uniform we set x0,i = 1 for all i then the formula becomes

 Θj = Θj - (α/m) * Σi=1m (h(Θ, xi) - yi) * xi,j

Note: I may have my notation for rows and columns mixed up in the formula - double check before using.

Gradient Descent in Practice 1 - Feature Scaling

Gradient Descent in Practice 2 - Learning Rate

Features and Polynomial Regression

Normal Equation

Normal Equation Noninvertibility