Suppose m=4 students have taken some class,and the class had a midterm exam and a final exam. You have collected a datasetof their scores on the two exams, which is as follows:
midterm exam | (midterm exam)2 | final exam |
89 | 7921 | 96 |
72 | 5184 | 74 |
94 | 8836 | 87 |
69 | 4761 | 78 |
You'd like to use polynomial regressionto predict a student's final exam score from their midterm exam score.Concretely, suppose you want to fit a model of the form , where is the midterm score and is (midterm score)2. Further, youplan to use bothfeature scaling (dividing by the "max-min", or range, of afeature) and mean normalization.
What is the normalized feature ? (Hint: midterm = 89, final = 96 is training example 1.)Please round off your answer to two decimal places and enter in the text boxbelow.
这是吴恩达机器学习的一道测试题,第一次做没有理解youplan to use bothfeature scaling (dividing by the "max-min", or range, of afeature) and mean normalization的意思所以做错了。从翻译来看这里应该是要求同时使用特征缩放和均值归一化来计算标准化后的特征,特征缩放时要除以max-min或者特征的范围。
常用的归一化方法有:
一、min-max标准化(Min-Max Normalization)
也称为离差标准化,是对原始数据的线性变换,使结果值映射到[0 - 1]之间。转换函数如下:
二、Z-score标准化方法
这种方法给予原始数据的均值(mean)和标准差(standard deviation)进行数据的标准化。经过处理的数据符合标准正态分布,即均值为0,标准差为1,转化函数为:
三、均值归一化
根据翻译知道我们应该采用均值归一化中以max-min为分母的归一化方法
计算结果是x1 =( 89 - (89+72+94+69)/4)/(96-69)=0.32