Andrew Ng Machine Learning 第二周
前言
网易云课堂(双语字幕,不卡):https://study.163.com/course/courseMain.htm?courseId=1004570029
Coursera:https://www.coursera.org/learn/machine-learning
本人初学者,先在网易云课堂上看网课,再去Coursera上做作业,开博客以记录,文章中引用图片皆为课程中所截,或者大佬笔记中所截。
多元线性回归Multivariate Linear Regression)
1.假设函数与代价函数
2.代价函数特征缩放
Tips:u1为x1的平均数,s1为x1max-x1min
3.学习率
根据J(θ)来判断α的大小是否合适
4.特征
简单来说,多项式中的多个变量可以简化成单一变量的变化形式。
Tips:根号形式保证图形不是二次函数,防止出现x增大而下降的情况
5.正规方程
方程式
y为n维向量,则
6.正规方程和梯度下降的选用
题目
Question 1.
解答:(89-(89+72+94+69)/4)/(94-69)=0.32
Question 2.
You run gradient descent for 15 iterations with α=0.3 and compute J(θ) after each iteration. You find that the value of J(θ) increases over time. Based on this, which of the following conclusions seems most plausible?
解答:A
Question 3.
Suppose you have m = 23 training examples with n = 5 features (excluding the additional all-ones feature for the intercept term, which you should add). The normal equation is θ= (XTX)(-1)*XTy.For the given values of mm and nn, what are the dimensions of θ, XX, and yy in this equation?
解答:D,X是n+1列,θ是n+1行,y是一列
Question 4.
Suppose you have a dataset with m = 50 examples and n = 200000 features for each example. You want to use multivariate linear regression to fit the parameters θ to our data. Should you prefer gradient descent or the normal equation?
解答:A,n过大
Question 5.
解答:D