ml-class icon indicating copy to clipboard operation
ml-class copied to clipboard

Feature scaling missing

Open davidglavas opened this issue 7 years ago • 1 comments
trafficstars

https://github.com/merwan/ml-class/blob/0b06b73d4aac0b8d7c726325200c3781b5c9d3b0/mlclass-ex1/ex1_multi.m#L153

The size and number of bedrooms should be scaled with the previously computed mean mu and standard deviation sigma.

From Andrew Ng's exercise sheet:

Implementation Note: When normalizing the features, it is important to store the values used for normalization - the mean value and the stan- dard deviation used for the computations. After learning the parameters from the model, we often want to predict the prices of houses we have not seen before. Given a new x value (living room area and number of bed- rooms), we must rst normalize x using the mean and standard deviation that we had previously computed from the training set.

davidglavas avatar Jan 28 '18 20:01 davidglavas

Suggestion:

price = 1650;
bedrooms = 3;
example = [1, (price-mu(1))/sigma(1), (bedrooms-mu(2))/sigma(2)];	% feature scaling
price = example*theta; % (You should change this) -> changed it.

davidglavas avatar Jan 28 '18 20:01 davidglavas