当前位置:天才代写 > Python代写 > 机器学习代写 > Machine Learning代写 Big Data Economics代写 Big Data Finance代写

Machine Learning代写 Big Data Economics代写 Big Data Finance代写

2020-09-24 17:38 星期四 所属: 机器学习代写 浏览:66

Machine Learning代写

Assignment 3

Machine Learning代写 Consider the two variables in the dataset Assign3.csv. We are interested in predicting the second variable

Machine Learning and Big Data for Economics and Finance

Consider the two variables in the dataset Assign3.csv. We are interested in predicting the second variable Y given the first variable X.Machine Learning代写

  1. Fit a linear regression model to the data. Show the data scatter plot on the samefigure with the values predicted by the linear
  2. Fit a quadratic regression model to the data. Show the data scatter plot on the same figure with the values predicted by the quadratic.Machine Learning代写
Machine Learning代写
Machine Learning代写

3.We are interested in constructing a step function learner asfollows:

First draw a random number U uniformly on the interval spanned by the minimum and maximum values of the inputs (x1; :::; xn) and then use it to construct the following function whose purpose is to give the prediction of Y given X x:

f(x) = a1I(U x) + a2I(U > x);Machine Learning代写

where a1 and a2. are just unknown constants to be learned. It goes without saying that I(some statement) is the indicator function that equals 1 when the statement is true and 0 otherwise.

a.Usetwo  different  methods  to  compute the  estimate  f^(x) = a^1I(U 6x)+a^2I(U > x).  Is f^ a strong learner?

b.Use one of the previous two methods to write an Rfunction that takes as input x and the data (x1; :::; xn; y1; :::; yn) and gives as output f^(x).

Make sure the function is capable of dealing with the case where

x conatains more than one number.Machine Learning代写

c.Usingthree different runs of the previous function, create three dif- ferent plots where, on each, f^ is shown together with the scatter plot of the

4.Write an R function that applies boosting to the previous step function learner.

That R function should take as inputs: the data, B the number of boosting iterations, L the learning rate and an optional argument indicating thesize of the test subsample in case a validation set approach is

As output the function should give:  f^boost  the boosted learner evaluated Machine Learning代写

at the training data and the training mean squared error evaluated for each iteration b = 1; :::; B of the boosting algorithm. Also, in case the size of the test subsample is greater than zero, the function should output:  f^boost  evaluated

at the test sample and the test MSE evaluated for each iteration b = 1; :::; B.

a.Use that  function  to  plot  f^boost   on  top  of  the  data  scatter  plot  for

L = 0.01 and for B = 10000. Show the same with different values of B.

b.Plot the training MSE vs. the number of iterations

c.Was there overfitting when B =10000?Machine Learning代写

Note: Even though the algorithm is described in detail in both the slides and textbook, for the sake of making the implementation easier, its special case per- taining to the questions in the assignment is presented here.

Boosting algorithm: Machine Learning代写

  1. Inputs:

A sample of covariates (i.e. inputs) x1; :::; xn and responses (i.e. out- puts) y1; :::; yn.

  • A (weak) learnerf^.
  • A learning rate L >0.Machine Learning代写
  1. Initialize:
  • Set f^boost(x  0.
  • Compute  the  first  learner  f^0(x) = a^1I(U x) + a^2I(U > x)  on  the original data.
  • Setri   yi ¡ Lf^0(xi) for i = 1; :::; n.
  1. Do the following for b = 1; :::;B:

a.Givenx1; :::; xn as covariates and r1; :::; rn as responses, fit a learner f^b by first sampling U and then estimating f^b(x) = a^1I(U x) + a^2I(U > x).

b.Set f^boost(x  f^boost(x) + Lf^b(x).Machine Learning代写

c.Setri   ri ¡ Lf^b(xi).

4.Output: f^boost(x).

Machine Learning代写
Machine Learning代写

更多其他:物理代写 考试助攻 assignment代写 代写作业 统计代写  算法代写 经济代写 金融代写 代写CS C++代写 java代写 r代写

合作平台:天才代写 幽灵代写 写手招聘 Essay代写

 

天才代写-代写联系方式