Homework_Week1_Coursera【Machine Learning】AndrewNg Stanford University、Introduction、Linear Regression、Linear Algebra
Homework
Introduction
Q1
A computer program is said to learn from experience E with respect to some task T and some performance measure P if its performance on T, as measured by P, improves with experience E.
Suppose we feed a learning algorithm a lot of historical weather data, and have it learn to predict weather. What would be a reasonable choice for P?
截图:
解析:题干大意是计算机程序从任务T和表现P中学习到经验E。T指代的是Task任务、E指的是学到的内容、P指的是比如任务T预测天气,预测的准不准?就是P、也就是D选项、是否准确的预测了日期的概率。
Q2
Suppose you are working on weather prediction, and you would like to predict whether or not it will be raining at 5pm tomorrow. You want to use a learning algorithm for this. Would you treat this as a classification or a regression problem?
截图:
解析:假设你正在做天气预测、预测明天下午5点会不会下雨、输出变量其实是离散的、下雨或者不下雨、所以我认为应当是分类问题、所以选A
Q3
Suppose you are working on stock market prediction. You would like to predict whether or not a certain company will declare bankruptcy within the next 7 days (by training on data of similar companies that had previously been at risk of bankruptcy). Would you treat this as a classification or a regression problem?
解析:抓题干、是否会破产、非常明显是分类问题、最终输出结果也是离散的,所以选B
Q4
Some of the problems below are best addressed using a supervised learning algorithm, and the others with an unsupervised learning algorithm. Which of the following would you apply supervised learning to? (Select all that apply.) In each case, assume some appropriate dataset is available for your algorithm to learn from.
解析:这题是多选题、就看每个选项是否是监督学习
A 有两队的数据了、所以是监督学习无疑问
B 给了一个人的基因。预测他接下来十年是否有糖尿病、同样是监督学习
C 取1000分文章,按照关键字相近和有关联分类、无监督学习分类可完成
D 从垃圾邮件中发现子类、无监督学习即可实现
Q5
Which of these is a reasonable definition of machine learning?
解析:A无标签数据也可以用于机器学习、A错误
B正确、确实是不需要明确的变成就能让电脑具备学习能力
C机器学习是给计算机编程的科学、不太妥当、机器学习更多是算法和思想、编程只是实现的手段和途径吧
D 给机器人赋予智能地行动就有点片面了
结束
Linear Regression with One Variable
Q1
Consider the problem of predicting how well a student does in her second year of college/university, given how well she did in her first year.
Specifically, let x be equal to the number of “A” grades (including A-. A and A+ grades) that a student receives in their first year of college (freshmen year). We would like to predict the value of y, which we define as the number of “A” grades they get in their second year (sophomore year).
For the training set given above (note that this training set may also be referenced in other questions in this quiz), what is the value of m? In the box below, please enter your answer (which should be a number between 0 and 10).
解析:
问的是m数值,we use m to denote the number of training examples.所以m代表训练集样本数量、
数一下,有4个
Q2
For this question, assume that we are using the training set from Q1. Recall our definition of the cost function was
What is J(0, 1)J(0,1)? In the box below, please enter your answer (Simplify fractions to decimals when entering answer, and ‘.’ as the decimal delimiter e.g., 1.5).
解析:
见图片
答案为0.5
Q3
解析:
见图片
答案为11
Q4
解析:选择AD
A已经是全局小损失函数了、在迭代一次损失函数为0,自然不会改变参数值了
Btheta0和1初始化位置不一样,极有可能会走向局部最优解、错过全局最优解,除非函数有特殊地形状,比如bowl function
C学习率非常小时候、怎么会speed up,只会slow down
D梯度下降发现损失函数增大了。可能就是学习率设置大了、导致的误差增大
Q5
解析:
A训练集上训练的再好,到测试集也不太会百分百准确、其中说的perfect就离谱
Btheta0和1是学习得来地,虽然都设置为0可以直接让损失函数为0但是、没有意义、0 乘上任何数都是0
C Possible可能的、如果不可能还机器学习什么呢
D没错、确实可可以按照训练集训练出完全拟合地模型、选择D选项
结果
Linear Algebra
Q1
Analysis:同型矩阵、按位置加减即可
Q2
Analysis:一个数乘矩阵,矩阵中的每位都不能落下
Q3
Analysis:u^T意思就是u转置,第一列变第一行、若是第一行就变第一列
Q4
Analysis:u转置后变为一行三列、乘以三行一列结果为一个数
Q5
Analysis:
A矩阵不存在交换律,不能随意调换顺序
B已经给出AB皆为33,此时相乘后仍然为33,再乘v后仍然存在3维度
C矩阵加减法需要同型,按位置加减即可,且为加法、前后位置无影响
D C=AB ,A、B是33,33、在中间两位数匹配的情况下,取最左最右两数、最终结果仍然为33矩阵
第一周任务到此结束