Machine Learning Lab Assignment 1

该博客旨在通过梯度下降算法解决并理解线性回归问题。介绍了实现单变量或多变量线性回归以预测因变量的问题,给出问题的输入(训练数据集)和输出(显示超平面系数、预测因变量值),还列举汽车保险和篮球数据的测试用例,并提及梯度下降算法的停止标准。

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

  • OBJECT OF THE ASSIGNMENT:
    To solve and understand linear regression problems by using gradient descent algorithm.
  • PROBLEM:
    Implement linear regression with one or multiple independent variables to predict a dependent (target) variable.
  • INPUT OF THE PROBLEM:
    Training dataset / testing examples
  • OUTPUT OF THE PROBLEM:
    (a) Display the coefficients of the hyperplane, i.e., w = (w0, w1, …, wM).
    (b) Predict values of the dependent variable for testing examples.
  • TESTING CASES:
    1. The file data1.txt contains a training set of Auto Insurance (汽車保險) in Sweden. The first column (= x) is the number of claims (索賠) and the second column (= y) is the total payment for all the claims in thousands of Swedish Kronor (瑞典克朗).
      (a) Find the regression line ŷ = w0 + w1x. Thus, use the gradient descent algorithm to find the weight w = (w0, w1).
      (b) Once you have found the regression equation, you can use the model to make predictions.
      (i) What is the predicted value of y when x = 45?
      (ii) What is the predicted value of y when x = 25?

    2. The file data2.txt contains a training set of Basketball. Columns 1 – 4 are the feature variables x1, x2, x3, x4, and column 5 is the target variable y. The following data (x1, x2, x3, x4, y) are for each player:
      x1 = height in feet
      x2 = weight in pounds
      x3 = percent of successful field goals (out of 100 attempted)
      x4 = percent of successful free throws (out of 100 attempted)
      y = average points scored per game
      (a) Find the hyperplane ŷ = w0 + w1x1+ w2x2+ w3x3+ w4x4. Thus, use the gradient descent algorithm to find the weight w = (w0, w1, w2, w3, w4).
      (b) Once you have found the hyperplane, you can use the model to make predictions.
      (i) What is the predicted value of y when (x1, x2, x3, x4) = (6.8, 210, 0.402, 0.739)?
      (ii) What is the predicted value of y when (x1, x2, x3, x4) = (6.1, 180, 0.415, 0.713)?

  • APPENDIX:
  • REMARKS:
    Stopping criteria of the Gradient descent algorithm usually includes:
    (a) Stop when a maximum number of iterations has been exceeded.
    (b) Stop when some error measure on the training set is small enough.
      For example:      
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值