日本欧洲视频一区_国模极品一区二区三区_国产熟女一区二区三区五月婷_亚洲AV成人精品日韩一区18p

COMP9417 代做、代寫 Python 語言程序

時(shí)間:2024-06-30  來源:  作者: 我要糾錯(cuò)



COMP9417 - Machine Learning
Homework 2: Bias, Variance and an application of Gradient
Descent
Introduction In this homework we revisit the notion of bias and variance as metrics for characterizing the
behaviour of an estimator. We then take a look at a new gradient descent based algorithm for combining
different machine learning models into a single, more complex, model.
Points Allocation There are a total of 28 marks.
 Question 1 a): 1 mark
 Question 1 b): 3 marks
Question 1 c): 3 marks
Question 1 d): 1 mark
 Question 1 e): 1 mark
Question 2 a): 3 marks
 Question 2 b): 2 marks
 Question 2 c): 6 marks
 Question 2 d): 2 marks
 Question 2 e): 3 marks
 Question 2 f): 2 marks
 Question 2 g): 1 mark
What to Submit
 A single PDF file which contains solutions to each question. For each question, provide your solution
in the form of text and requested plots. For some questions you will be requested to provide screen
shots of code used to generate your answer — only include these when they are explicitly asked for.
 .py file(s) containing all code you used for the project, which should be provided in a separate .zip
file. This code must match the code provided in the report.
1
 You may be deducted points for not following these instructions.
 You may be deducted points for poorly presented/formatted work. Please be neat and make your
solutions clear. Start each question on a new page if necessary.
You cannot submit a Jupyter notebook; this will receive a mark of zero. This does not stop you from
developing your code in a notebook and then copying it into a .py file though, or using a tool such as
nbconvert or similar.
 We will set up a Moodle forum for questions about this homework. Please read the existing questions
before posting new questions. Please do some basic research online before posting questions. Please
only post clarification questions. Any questions deemed to be fishing for answers will be ignored
and/or deleted.
 Please check Moodle announcements for updates to this spec. It is your responsibility to check for
announcements about the spec.
 Please complete your homework on your own, do not discuss your solution with other people in the
course. General discussion of the problems is fine, but you must write out your own solution and
acknowledge if you discussed any of the problems in your submission (including their name(s) and
zID).
 As usual, we monitor all online forums such as Chegg, StackExchange, etc. Posting homework ques-
tions on these site is equivalent to plagiarism and will result in a case of academic misconduct.
You may not use SymPy or any other symbolic programming toolkits to answer the derivation ques-
tions. This will result in an automatic grade of zero for the relevant question. You must do the
derivations manually.
When and Where to Submit
 Due date: Week 5, Friday June 28th, 2024 by 5pm. Please note that the forum will not be actively
monitored on weekends.
Late submissions will incur a penalty of 5% per day from the maximum achievable grade. For ex-
ample, if you achieve a grade of 80/100 but you submitted 3 days late, then your final grade will be
80? 3× 5 = 65. Submissions that are more than 5 days late will receive a mark of zero.
? Submission must be made on Moodle, no exceptions.
Page 2
Question 1. Bias of Estimators
Let γ > 0 and suppose that X1, . . . , Xn
i.i.d.~ N(γ, γ2). We define:
X =
1
n
n∑
i=1
Xi,
S2 =
1
n? 1
n∑
i=1
(Xi ?X)2.
You may use the following two facts without proof:
(F1) X and S2 are independent.
(F2) X and c?S are both unbiased estimators of γ.1
What to submit: for all parts (a)-(e), include your working out, either typed or handwritten. For all parts, you
must show all working for full credit. Answers without working will receive a grade of zero.
(a) Consider the estimator:
T1 = aX + (1? a)c?S.
Show that for any choice of constant a, T1 is unbiased for γ.
(b) What choice of a gives you the best (in the sense of MSE) possible estimator? Derive an explicit
expression for this optimal choice of a. We refer to this estimator as T ?1 .
(c) Consider now a different estimator:
T2 = a1Xˉ + a2(c?S),
and we do not make any assumptions about the relationship between a1 and a2. Find the con-
stants a1, a2 explicitly that make T2 best (from the MSE perspective), i.e. choose a1, a2 to minimize
MSE(T2) = E(T2 ? γ)2. We refer to this estimator as T ?2 .
(d) Show that T ?2 has MSE that is less than or equal to the MSE of T ?1 .
(e) Consider the estimator V+ = max{0, T ?2 }. Show that the MSE of V+ is smaller than or equal to the
MSE of T ?2 .
Question 2. Gradient Descent for Learning Combinations of Models
In this question, we discuss and implement a gradient descent based algorithm for learning combina-
tions of models, which are generally termed ’ensemble models’. The gradient descent idea is a very
powerful one that has been used in a large number of creative ways in machine learning beyond direct
minimization of loss functions.
The Gradient-Combination (GC) algorithm can be described as follows: Let F be a set of base learning
algorithms2. The idea is to combine the base learners in F in an optimal way to end up with a good
learning algorithm. Let `(y, y?) be a loss function, where y is the target, and y? is the predicted value.3
Suppose we have data (xi, yi) for i = 1, . . . , n, which we collect into a single data set D0. We then set
the number of desired base learners to T and proceed as follows:
1You do not need to worry about knowing or calculating c? for this question, it is just some constant.
2For example, you could take F to be the set of all regression models with a single feature, or alternatively the set of all regression
models with 4 features, or the set of neural networks with 2 layers etc.
3Note that this set-up is general enough to include both regression and classification algorithms.
Page 3
(I) Initialize f0(x) = 0 (i.e. f0 is the zero function.)
(II) For t = 1, 2, . . . , T :
(GC1) Compute:
rt,i = ? ?
?f(xi)
n∑
j=1
`(yj , f(xj))
∣∣∣∣
f(xj)=ft?1(xj), j=1,...,n
for i = 1, . . . , n. We refer to rt,i as the i-th pseudo-residual at iteration t.
(GC2) Construct a new pseudo data set, Dt, consisting of pairs: (xi, rt,i) for i = 1, . . . , n.
(GC3) Fit a model to Dt using our base class F . That is, we solve
ht = arg min
f∈F
n∑
i=1
`(rt,i, f(xi))
(GC4) Choose a step-size. This can be done by either of the following methods:
(SS1) Pick a fixed step-size αt = α
(SS2) Pick a step-size adaptively according to
αt = arg min
α
n∑
i=1
`(yi, ft?1(xi) + αht(xi)).
(GC5) Take the step
ft(x) = ft?1(x) + αtht(x).
(III) return fT .
We can view this algorithm as performing (functional) gradient descent on the base class F . Note that
in (GC1), the notation means that after taking the derivative with respect to f(xi), set all occurences
of f(xj) in the resulting expression with the prediction of the current model ft?1(xj), for all j. For
example:
?
?x
log(x+ 1)
∣∣∣∣
x=23
=
1
x+ 1
∣∣∣∣
x=23
=
1
24
.
(a) Consider the regression setting where we allow the y-values in our data set to be real numbers.
Suppose that we use squared error loss `(y, y?) = 12 (y? y?)2. For round t of the algorithm, show that
rt,i = yi ? ft?1(xi). Then, write down an expression for the optimization problem in step (GC3)
that is specific to this setting (you don’t need to actually solve it).
What to submit: your working out, either typed or handwritten.
(b) Using the same setting as in the previous part, derive the step-size expression according to the
adaptive approach (SS2).
What to submit: your working out, either typed or handwritten.
(c) We will now implement the gradient-combination algorithm on a toy dataset from scratch, and we
will use the class of decision stumps (depth 1 decision trees) as our base class (F), and squared error
loss as in the previous parts.4. The following code generates the data and demonstrates plotting
the predictions of a fitted decision tree (more details in q1.py):
4In your implementation, you may make use of sklearn.tree.DecisionTreeRegressor, but all other code must be your
own. You may use NumPy and matplotlib, but do not use an existing implementation of the algorithm if you happen to find one.
Page 4
1 np.random.seed(123)
2 X, y = f_sampler(f, 160, sigma=0.2)
3 X = X.reshape(-1,1)
4
5 fig = plt.figure(figsize=(7,7))
6 dt = DecisionTreeRegressor(max_depth=2).fit(X,y) # example model
7 xx = np.linspace(0,1,1000)
8 plt.plot(xx, f(xx), alpha=0.5, color=’red’, label=’truth’)
9 plt.scatter(X,y, marker=’x’, color=’blue’, label=’observed’)
10 plt.plot(xx, dt.predict(xx.reshape(-1,1)), color=’green’, label=’dt’) # plotting
example model
11 plt.legend()
12 plt.show()
13
The figure generated is
Your task is to generate a 5 x 2 figure of subplots showing the predictions of your fitted gradient-
combination model. There are 10 subplots in total, the first should show the model with 5 base
learners, the second subplot should show it with 10 base learners, etc. The last subplot should be
the gradient-combination model with 50 base learners. Each subplot should include the scatter of
data, as well as a plot of the true model (basically, the same as the plot provided above but with
your fitted model in place of dt). Comment on your results, what happens as the number of base
learners is increased? You should do this two times (two 5x2 plots), once with the adaptive step
size, and the other with the step-size taken to be α = 0.1 fixed throughout. There is no need to
split into train and test data here. Comment on the differences between your fixed and adaptive
step-size implementations. How does your model perform on the different x-ranges of the data?
What to submit: two 5 x 2 plots, one for adaptive and one for fixed step size, some commentary, and a screen
shot of your code and a copy of your code in your .py file.
Page 5
(d) Repeat the analysis in the previous question but with depth 2 decision trees as base learners in-
stead. Provide the same plots. What do you notice for the adaptive case? What about the non-
adaptive case? What to submit: two 5 x 2 plots, one for adaptive and one for fixed step size, some commen-
tary, and a copy of your code in your .py file.
(e) Now, consider the classification setting where y is taken to be an element of {?1, 1}. We consider
the following classification loss: `(y, y?) = log(1 + e?yy?). For round t of the algorithm, what is the
expression for rt,i? Write down an expression for the optimization problem in step (GC3) that is
specific to this setting (you don’t need to actually solve it).
What to submit: your working out, either typed or handwritten.
(f) Using the same setting as in the previous part, write down an expression for αt using the adaptive
approach in (SS2). Can you solve for αt in closed form? Explain.
What to submit: your working out, either typed or handwritten, and some commentary.
(g) In practice, if you cannot solve for αt exactly, explain how you might implement the algorithm.
Assume that using a constant step-size is not a valid alternative. Be as specific as possible in your
answer. What, if any, are the additional computational costs of your approach relative to using a
constant step size ?
What to submit: some commentary.



請加QQ:99515681  郵箱:99515681@qq.com   WX:codinghelp












 

標(biāo)簽:

掃一掃在手機(jī)打開當(dāng)前頁
  • 上一篇:FT312編程代寫、代做C++,Python程序
  • 下一篇:公式指標(biāo)代寫 指標(biāo)股票公式定制開發(fā)
  • 無相關(guān)信息
    昆明生活資訊

    昆明圖文信息
    蝴蝶泉(4A)-大理旅游
    蝴蝶泉(4A)-大理旅游
    油炸竹蟲
    油炸竹蟲
    酸筍煮魚(雞)
    酸筍煮魚(雞)
    竹筒飯
    竹筒飯
    香茅草烤魚
    香茅草烤魚
    檸檬烤魚
    檸檬烤魚
    昆明西山國家級風(fēng)景名勝區(qū)
    昆明西山國家級風(fēng)景名勝區(qū)
    昆明旅游索道攻略
    昆明旅游索道攻略
  • NBA直播 短信驗(yàn)證碼平臺 幣安官網(wǎng)下載 歐冠直播 WPS下載

    關(guān)于我們 | 打賞支持 | 廣告服務(wù) | 聯(lián)系我們 | 網(wǎng)站地圖 | 免責(zé)聲明 | 幫助中心 | 友情鏈接 |

    Copyright © 2025 kmw.cc Inc. All Rights Reserved. 昆明網(wǎng) 版權(quán)所有
    ICP備06013414號-3 公安備 42010502001045

    日本欧洲视频一区_国模极品一区二区三区_国产熟女一区二区三区五月婷_亚洲AV成人精品日韩一区18p

              香蕉成人啪国产精品视频综合网| 国产一区二区三区高清| 亚洲第一综合天堂另类专| 亚洲综合电影| 欧美色网在线| 日韩亚洲欧美一区| 欧美精品久久一区二区| 亚洲成色777777在线观看影院| 欧美在线啊v| 国产精品免费观看视频| 亚洲香蕉视频| 国产精品免费观看在线| 亚洲一区二区三区久久| 欧美小视频在线| 亚洲在线日韩| 国产免费成人av| 欧美在线视频在线播放完整版免费观看| 国产精品视频不卡| 欧美亚洲日本网站| 国产一区二区三区精品欧美日韩一区二区三区 | 国产精品成人aaaaa网站| 一区二区精品在线| 国产精品igao视频网网址不卡日韩| 亚洲剧情一区二区| 欧美三级不卡| 午夜日韩激情| 激情成人综合| 欧美激情精品久久久久久| 亚洲精品视频在线播放| 欧美午夜精品理论片a级大开眼界| 一区二区日韩| 国产美女精品| 久热精品视频| 亚洲另类春色国产| 国产精品久久久久久影视| 欧美在线一区二区三区| 在线观看国产精品网站| 欧美高清在线视频观看不卡| 亚洲美女黄网| 国产精品一区二区三区久久| 久久久亚洲一区| 亚洲久久一区二区| 国产精品影音先锋| 裸体一区二区| 亚洲视频在线二区| 国产综合色产在线精品| 欧美精品色综合| 羞羞色国产精品| 亚洲精品美女久久7777777| 欧美午夜寂寞影院| 久久麻豆一区二区| 中文在线不卡视频| 在线免费日韩片| 国产精品久久久久久户外露出| 久久精品一二三区| 一区二区日韩| 在线看日韩av| 国产美女精品视频免费观看| 男人的天堂亚洲| 午夜精品一区二区三区电影天堂| 亚洲韩国日本中文字幕| 国产精品亚发布| 欧美片在线播放| 久久久午夜精品| 亚洲欧美影院| 99视频超级精品| 影音国产精品| 国产欧美 在线欧美| 欧美日韩亚洲精品内裤| 可以免费看不卡的av网站| 亚洲女人天堂成人av在线| 亚洲精品在线观| 亚洲第一中文字幕| 国产在线观看91精品一区| 欧美午夜免费| 欧美人在线视频| 欧美1区2区| 麻豆成人综合网| 久久精品网址| 欧美一级久久| 亚洲欧美久久久久一区二区三区| 亚洲国产影院| 伊人伊人伊人久久| 国内久久视频| 国产综合亚洲精品一区二| 国产精品高潮呻吟久久av无限| 欧美成人免费va影院高清| 久久一区亚洲| 久久综合给合久久狠狠色 | 国模精品一区二区三区| 国产精品亚洲欧美| 国产精品久久久久久影视 | 精品成人免费| 国内精品久久久| 狠狠色噜噜狠狠狠狠色吗综合| 国产精品自拍网站| 国产毛片精品视频| 国产欧美日韩一区| 国产一区二区三区丝袜| 国产在线精品成人一区二区三区| 国产日韩欧美在线播放| 国产一区日韩二区欧美三区| 国产真实精品久久二三区| 黄色精品一区二区| 亚洲电影网站| 日韩视频在线免费观看| 亚洲无限乱码一二三四麻| 亚洲在线成人| 久久精品视频在线| 麻豆精品在线视频| 欧美韩日视频| 欧美午夜不卡| 国产主播一区二区| 伊人久久大香线蕉av超碰演员| 亚洲国产色一区| 在线视频免费在线观看一区二区| 亚洲一级片在线观看| 欧美伊人久久久久久久久影院 | 一区二区三区四区国产精品| 亚洲一区视频在线| 午夜一区在线| 美女视频一区免费观看| 欧美日韩在线第一页| 国产精品色一区二区三区| 狠狠色狠狠色综合| 亚洲国产网站| 亚洲一区二区精品在线| 久久午夜影视| 欧美三级特黄| 激情综合在线| 中国成人黄色视屏| 久久久噜噜噜久久久| 欧美日韩国产一中文字不卡| 国产麻豆日韩| 亚洲精品在线一区二区| 欧美专区亚洲专区| 欧美激情第三页| 国产亚洲成精品久久| 亚洲国产欧美精品| 亚洲永久视频| 久久先锋影音| 国产精品欧美一区喷水| 在线观看久久av| 亚洲欧美日韩专区| 欧美刺激午夜性久久久久久久| 国产精品自在线| 亚洲精品欧洲| 久久免费视频一区| 国产精品免费一区豆花| 亚洲经典三级| 久久人人爽爽爽人久久久| 国产精品户外野外| 亚洲理论在线观看| 久久婷婷久久| 国产亚洲一区精品| 亚洲欧美日韩国产综合精品二区| 欧美不卡高清| 国内揄拍国内精品久久| 亚洲自拍偷拍福利| 欧美日本在线| 亚洲激情第一区| 久久久久国产精品厨房| 国产精品免费看久久久香蕉| 一区二区高清在线| 欧美日韩亚洲一区二区| 亚洲激情视频网| 久久尤物视频| 狠狠入ady亚洲精品| 欧美一区二区三区日韩| 国产伦理一区| 欧美在线看片a免费观看| 国产精品看片你懂得| 亚洲婷婷综合久久一本伊一区| 欧美连裤袜在线视频| 亚洲精品乱码久久久久久久久 | 亚洲精品永久免费| 欧美国产一区二区三区激情无套| 在线观看久久av| 久久综合电影| 伊伊综合在线| 美国成人直播| 亚洲国产毛片完整版| 欧美mv日韩mv国产网站| 亚洲欧洲综合| 欧美日韩亚洲一区三区| 中文精品视频| 国产老肥熟一区二区三区| 欧美一区二区视频在线观看| 国产日韩在线亚洲字幕中文| 欧美一级理论性理论a| 国产欧美日韩免费看aⅴ视频| 欧美一区二区精美| 国产在线精品一区二区夜色| 欧美专区日韩视频| 136国产福利精品导航| 欧美成年视频| 亚洲私人影吧| 国产一区二区高清| 美女精品视频一区| 亚洲伦理在线观看|