reset password
Author Message
vsevak
Posts: 18
Posted 23:24 Feb 03, 2016 |

3. Implement scale_features as per lecture, it should take one training example and return a vector of scaled and mean-normalized values.

I have small doubt about this. Correct me if i am wrong.

Here you asked us to take one training example as input. So in ppt it says training example is row of a table.

But while explaining feature scaling in ppt, it takes X1, X2 which are columns of given data.

What should we take ? Please advise.

Thanks

khsu
Posts: 30
Posted 23:49 Feb 03, 2016 |

I believe it should be a row, which is precisely what you correctly defined as a training example.

 

In the power point, where they take in X1 and X2, those are examples of features taken from one training example. 

vsevak
Posts: 18
Posted 23:51 Feb 03, 2016 |

Ok.

So we have approximately 415 rows in our data. So we need to find scale and normalize values for all training examples. right??

khsu
Posts: 30
Posted 00:22 Feb 04, 2016 |

Yes, we'll need to normalize them all.

vsevak
Posts: 18
Posted 00:37 Feb 04, 2016 |

ok thanks a lot.

lmann2
Posts: 156
Posted 19:08 Feb 13, 2016 |

Actually this one still isn't clear to me.  The slides actually say to take the mean of each row divided by the range on of the column.  I don't think we should be marked down for this, it's a bit unclear.  Can anyone clarify???

msargent
Posts: 519
Posted 19:29 Feb 13, 2016 |

I was clear about it, so was Andrew Ng. You guys should really watch the videos. I will take off for doing it incorrectly. 

Feature_scaling(single_value) = single_value - mean of feature (use the value's column over all training examples --- what else could it be?!?)/max of value. You can substitute scale or standard deviation for max. 

Now if you are doing it for a vector of values, just apply this rule to each value in the vector.

Example: Each row is a training example

feature1 feature2 feature3
2 1 4
1 2 5
3 3 6

Means:         2                                        2                                        5

Max:             3                                        3                                         6

normalize (first_training example --- the first row) = [(2-2)/3, (1-2)/3, (4-5)/6] = [0, -.33, -.167]

 

Last edited by msargent at 19:46 Feb 13, 2016.
lmann2
Posts: 156
Posted 23:42 Feb 13, 2016 |

lol, I did, three times now, that's why i'm confused. His definition right before the 8 minute mark in Gradient Decent in practice I is slightly different then yours.  I'll go with your definition.