首页 » 代码代写 » 机器学习代写|CSE 151A: Introduction to Machine Learning Homework Assignment 2

机器学习代写|CSE 151A: Introduction to Machine Learning Homework Assignment 2

这是一篇英国的机器学习包课代码代写

 

1 (10 points) Nearest Neighbor Classifification

You are given the points belonging to class- 1 and class-2 as follows:

Class 1 points: (11, 11),(13, 11),(8, 10),(9, 9),(7, 7),(7, 5),(16, 3)

Class 2 points: (7, 11),(15, 9),(15, 7),(13, 5),(14, 4),(9, 3),(11, 3)

What is the label of the sample (14, 3) using the nearest neighbor classififier using L2 distance?

2 (10 points) Gradient Descent – Linear Regression

Consider house rent prediction problem where you are supposed to predict price of a house based on just its area. Suppose you have n samples with their respective areas, x (1), x(2), . . . , x(n),their true house rents y (1), y(2), . . . , y(n) . Let’s say, you train a linear regressor that predicts f (xi)θ + θ1.x(i).The parameters θ0 and θ1 are scalars and are learned by minimizing mean-squared-error loss through gradient descent with a learning rate α. Answer the following questions.

  1. Express the loss function(L) in terms of x(i) , y(i) , n, θ0, θ1.
  2. Compute ∂θ/∂L0
  1. Compute ∂θ/∂L1
  1. Write update rules for θ0 and θ1

3 (10 points) Gradient Descent – Linear Regression  with L1 Regularization

Consider the same house rent prediction problem where you are supposed to predict price of a house based on just its area. Suppose you have n samples with their respective areas,x (1), x(2), . . . , x(n) , their true house rents y (1), y(2), . . . , y(n) . Let’s say, you train a linear regressor that predicts f(x(i) ) = θ0 + θ1x(i) . The parameters θ0 and θ1 are scalars and are learned by minimizing mean-squared-error loss with L1-regularization through gradient descent with a learning rate α. Answer the following questions.

  1. Express the loss function(L) in terms of x(i) , y(i) , n, θ0, θ1.
  2. Compute ∂θ ∂L0
  1. Compute ∂θ ∂L1
  1. Write update rules for θ0 and θ1

4 (10 points) Gradient Descent – Linear Regression with L2 Regularization

Consider the same house rent prediction problem where you are supposed to predict price of a house based on just its area. Suppose you have n samples with their respective areas,x (1), x(2), . . . , x(n) , their true house rents y (1), y(2), . . . , y(n) . Let’s say, you train a linear regressor that predicts f(x(i) ) = θ0 + θ1x(i) . The parameters θ0 and θ1 are scalars and are learned by minimizing mean-squared-error loss with L2-regularization through gradient descent with a learning rate α. Answer the following questions.

  1. Express the loss function(L) in terms of x(i) , y(i) , n, θ0, θ1.
  2. Compute ∂θ/∂L0
  1. Compute ∂θ/∂L1
  1. Write update rules for θ0 and θ1

5 (60 points) Implementing a Linear Regression Model from Scratch

Now, you will implement a linear regression model from scratch. We have provided a skeleton code fifile (i.e. LinearRegression.py) for you to implement the algorithm as well as a notebook fifile (i.e. Linear Regression.ipynb) for you to conduct experiment and answer relevant questions. Libraries such as numpy and pandas may be used for auxiliary tasks (such as matrix multiplication, matrix inversion, and so on), but not for the algorithms. That is, you can use numpy to implement your model, but cannot directly call libraries such as scikit-learn to get a linear regression model for your skeleton code. We will grade this question based on the three following criteria:

  1. Your implementation in code. Please do not change the structure of our skeleton code.
  2. Your model’s performance (we check if your model behaves correctly based on the results from multiple experiments in the notebook fifile).
  1. Your written answers for questions in the notebook fifile.

6 What to submit?

A single PDF fifile that includes:

  1. Answers for Q1-Q4
  2. LinearRegression.py fifile for your linear regression model implementation. If you are unable to directly convert the .py fifile into a PDF, you can copy and paste all the code from that .py fifile into the Linear Regression.ipynb within a single cell.
  1. The Linear Regression.ipynb fifile for your experiments and relevant answers. Please do not clear the outputs of each code cell for submission as we need to check your model’s outputs as well.

程序辅导定制C/C++/JAVA/安卓/PYTHON/留学生/PHP/APP开发/MATLAB


本网站支持 Alipay WeChatPay PayPal等支付方式

E-mail: vipdue@outlook.com  微信号:vipnxx


如果您使用手机请先保存二维码,微信识别。如果用电脑,直接掏出手机果断扫描。

blank