Machine Learning week 1 quiz: Linear Regression with One Variable

探讨如何利用线性回归预测学生的第二年学术表现,通过分析第一年的成绩来预测第二年的成绩。介绍了一个小样本训练集,并展示了如何计算训练集中实例的数量。进一步解释了如何在给定的数据上应用线性回归模型,以及如何通过梯度下降法求解参数θ0和θ1。此外,还讨论了在给定初始参数的情况下,如何计算预测值hθ(6),并深入探讨了梯度下降法的特性和可能遇到的问题。最后,提出了对于特定线性回归问题,能够完美预测结果的条件。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Linear Regression with One Variable

1. 

Consider the problem of predicting how well a student does in her second year of college/university, given how well they did in their 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).

Refer to the following training set of a small sample of different students' performances (note that this training set will also be referenced in other questions in this quiz). Here each row is one training example. Recall that in linear regression, our hypothesis is hθ(x)=θ0+θ1x, and we use m to denote the number of training examples.

For the training set given above, what is the value of m? In the box below, please enter your answer (which should be a number between 0 and 10).

2. 

Consider the following training set of m=4 training examples:

   x       y   
   1       0.5   
   2       1   
   4       2   
   0       0   

Consider the linear regression model hθ(x)=θ0+θ1x. What are the values of θ0 and θ1 that you would expect to obtain upon running gradient descent on this model? (Linear regression will be able to fit this data perfectly.)

θ0=0,θ1=0.5

θ0=1,θ1=1

θ0=0.5,θ1=0

θ0=0.5,θ1=0.5

θ0=1,θ1=0.5

3. 

Suppose we set θ0=2,θ1=0.5. What is hθ(6)?

4. 

Let f be some function so that

f(θ0,θ1) outputs a number. For this problem,

f is some arbitrary/unknown smooth function (not necessarily the

cost function of linear regression, so f may have local optima).

Suppose we use gradient descent to try to minimize f(θ0,θ1)

as a function of θ0 and θ1. Which of the

following statements are true? (Check all that apply.)

If θ0 and θ1 are initialized at

a local minimum, then one iteration will not change their values.

If θ0 and θ1 are initialized so that θ0=θ1, then by symmetry (because we do simultaneous updates to the two parameters), after one iteration of gradient descent, we will still have θ0=θ1.

If the learning rate is too small, then gradient descent may take a very long

time to converge.

Even if the learning rate α is very large, every iteration of

gradient descent will decrease the value of f(θ0,θ1).

5. 

Suppose that for some linear regression problem (say, predicting housing prices as in the lecture), we

have some training set, and for our training set we managed to find some θ0θ1 such that J(θ0,θ1)=0. Which

of the statements below must then be true? (Check all that apply.)

For these values of θ0 and θ1 that satisfy J(θ0,θ1)=0,

we have that hθ(x(i))=y(i) for every training example (x(i),y(i))

For this to be true, we must have θ0=0 and θ1=0

so that hθ(x)=0

We can perfectly predict the value of y even for new examples that we have not yet seen.

(e.g., we can perfectly predict prices of even new houses that we have not yet seen.)

This is not possible: By the definition of J(θ0,θ1), it is not possible for there to exist

θ0 and θ1 so that J(θ0,θ1)=0


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值