Skip to content

Instantly share code, notes, and snippets.

@rvndbalaji
Created July 24, 2018 14:20
Show Gist options
  • Save rvndbalaji/f08bd39bdf0f0e70ce17b1b0ff6d6a41 to your computer and use it in GitHub Desktop.
Save rvndbalaji/f08bd39bdf0f0e70ce17b1b0ff6d6a41 to your computer and use it in GitHub Desktop.
#Feature Scaling & Mean Normalization
#This function is EXACTLY equivalent to the scale() function in R
//Remember to exclude the last column of the data, we should not normalize what we predict.
room_n = scale(room[1:5])
//Or all this function
normalize = function(x)
{
return ((x - mean(x))/sd(x))
}
#Merge the last column after normalizing, which we initially excluded.
room_n = cbind(room_n,room[6])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment