美女扒开腿免费视频_蜜桃传媒一区二区亚洲av_先锋影音av在线_少妇一级淫片免费放播放_日本泡妞xxxx免费视频软件_一色道久久88加勒比一_熟女少妇一区二区三区_老司机免费视频_潘金莲一级黄色片_精品国产精品国产精品_黑人巨大猛交丰满少妇

COMP9417 代做、代寫 Python 語言程序

時間:2024-06-30  來源:  作者: 我要糾錯



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












 

標簽:

掃一掃在手機打開當前頁
  • 上一篇:FT312編程代寫、代做C++,Python程序
  • 下一篇:公式指標代寫 指標股票公式定制開發
  • 無相關信息
    昆明生活資訊

    昆明圖文信息
    蝴蝶泉(4A)-大理旅游
    蝴蝶泉(4A)-大理旅游
    油炸竹蟲
    油炸竹蟲
    酸筍煮魚(雞)
    酸筍煮魚(雞)
    竹筒飯
    竹筒飯
    香茅草烤魚
    香茅草烤魚
    檸檬烤魚
    檸檬烤魚
    昆明西山國家級風景名勝區
    昆明西山國家級風景名勝區
    昆明旅游索道攻略
    昆明旅游索道攻略
  • 短信驗證碼平臺 理財 WPS下載

    關于我們 | 打賞支持 | 廣告服務 | 聯系我們 | 網站地圖 | 免責聲明 | 幫助中心 | 友情鏈接 |

    Copyright © 2025 kmw.cc Inc. All Rights Reserved. 昆明網 版權所有
    ICP備06013414號-3 公安備 42010502001045

    美女扒开腿免费视频_蜜桃传媒一区二区亚洲av_先锋影音av在线_少妇一级淫片免费放播放_日本泡妞xxxx免费视频软件_一色道久久88加勒比一_熟女少妇一区二区三区_老司机免费视频_潘金莲一级黄色片_精品国产精品国产精品_黑人巨大猛交丰满少妇
    久久性爱视频网站| 人妻熟女aⅴ一区二区三区汇编| 一本色道久久hezyo无码| 日韩av毛片在线观看| 国产在视频线精品视频| 中国美女黄色一级片| 91麻豆精品成人一区二区| 在线观看黄网址| 久草综合在线视频| 国产精品扒开腿做爽爽爽a片唱戏| 扒开伸进免费视频| 90岁老太婆乱淫| www.xx日本| 国产免费一区二区三区最新6| free性中国hd国语露脸| 亚洲精品国产一区黑色丝袜| av黄色在线免费观看| 日韩一卡二卡在线观看| 中文字幕永久免费| 白丝女仆被免费网站| 日韩av毛片在线观看| wwwxx日本| fc2ppv在线播放| 精品无码在线视频| 午夜免费激情视频| 欧美做受高潮6| 美女日批在线观看| 内射毛片内射国产夫妻| 亚洲av无码一区东京热久久| 成年人在线免费看片| 女同性αv亚洲女同志| 性猛交ⅹxxx富婆video| 精品无码av一区二区三区| 色屁屁草草影院ccyy.com| 精品无码人妻少妇久久久久久| 欧美特黄一区二区三区| 亚洲成a人片在线www| 亚洲欧美精品久久| 免费看黄色av| 久久人人妻人人人人妻性色av| 一级性生活免费视频| 99久久精品免费视频| 国产白嫩美女无套久久| 4438x全国最大成人| 91精品少妇一区二区三区蜜桃臀| 蜜桃传媒一区二区亚洲av| 久久久精品人妻一区二区三区| 国产精品酒店视频| 久久精品三级视频| 国产精品密蕾丝袜| 国产制服丝袜在线| 免费无码一区二区三区| 国产老熟女伦老熟妇露脸| 韩国一区二区三区四区| 免费看的av网站| 人妻精品久久久久中文字幕69| 国产又粗又长又硬| 制服丨自拍丨欧美丨动漫丨| 摸摸摸bbb毛毛毛片| 少妇人妻好深好紧精品无码| 亚洲av片不卡无码久久| 中国美女乱淫免费看视频| 波多野结衣先锋影音| 熟女少妇一区二区三区| 一区二区三区伦理片| 国产精品美女高潮无套| av在线播放中文字幕| 国产精品国产三级国产传播| www.av免费| 国产视频精品视频| 无码h肉动漫在线观看| 免费福利视频网站| 国产人妻精品久久久久野外| 国产女主播在线播放| 国产一级二级在线观看| 国产又粗又黄又猛| 中文字幕第六页| 国产精品一区二区入口九绯色| www在线观看免费视频| 免费成人美女女在线观看| 日本一区二区三区在线免费观看| 这里只有精品在线观看视频| 天堂久久精品忘忧草| 精品无码久久久久成人漫画| 无码国产69精品久久久久网站| 青青草福利视频| 香蕉视频在线观看黄| 国产吞精囗交久久久| 精品国产视频一区二区三区| 国产麻豆剧传媒精品国产av| 日本视频在线免费| 呦呦视频在线观看| 国产成人综合在线视频| 女~淫辱の触手3d动漫| 国产成人精品综合久久久久99| 人人妻人人澡人人爽人人精品 | 女人黄色一级片| 色哟哟网站在线观看| 亚洲一区 欧美| 国产麻豆天美果冻无码视频| 91精品国自产在线偷拍蜜桃| 波多野结衣av在线观看| 7788色淫网站小说| 中文字幕乱码在线人视频| 免费黄色片网站| 97人妻精品一区二区免费| 中文字幕永久免费| 国产日韩欧美在线观看视频| 亚洲精品91在线| 中文字幕网站在线观看| 亚洲熟妇无码av| 手机在线看片日韩| 99久久国产精| 黄瓜视频污在线观看| 国产美女喷水视频| 中文乱码人妻一区二区三区视频| 亚洲少妇一区二区三区| 无套白嫩进入乌克兰美女| 国产精品 欧美激情| www.色小姐com| 亚洲最大视频网| 911亚洲精选| 亚洲一区二区三区无码久久| 美女又爽又黄免费| 亚洲第一页av| 国产精品久久久久久久av| 天堂久久精品忘忧草| 免费看裸体网站| 男人与禽猛交狂配| 挪威xxxx性hd极品| 欲求不满的岳中文字幕| 久久精品一区二区免费播放| 中文字幕免费高清| 成人一级黄色大片| 亚洲图片欧美另类| 亚洲成人黄色av| 日日骚一区二区三区| 97人妻精品一区二区三区免费 | 久久精品综合视频| 99久久精品免费视频| 国产黄a三级三级| 成人欧美精品一区二区| 欧美特黄一区二区三区| 麻豆天美蜜桃91| 国产乱了高清露脸对白| 国产日产在线观看| 极品白嫩的小少妇| 熟女少妇a性色生活片毛片| 中文字幕永久免费| 肉色超薄丝袜脚交69xx图片 | 一区二区视频观看| 毛片久久久久久| 好吊一区二区三区视频| 中国一级片在线观看| 亚洲色图14p| 懂色av懂色av粉嫩av| 中文字幕一二三四区| 日本在线视频播放| 欧美特黄一级片| 久久视频精品在线观看| www国产视频| 中文字幕在线播放一区二区| 非洲一级黄色片| 9.1成人看片| 欧美夫妇交换xxx| 国产在线观看免费视频软件| 插我舔内射18免费视频| 一级全黄裸体片| 黄视频网站免费看| 亚洲AV成人无码精电影在线| 婷婷色一区二区三区| 人人妻人人藻人人爽欧美一区| 精品人妻二区中文字幕| 午夜爽爽爽男女免费观看| 人妻av无码一区二区三区| 在线观看国产网站| 国产亚洲色婷婷久久99精品91| 成人一区二区三区仙踪林| 日本一级二级视频| 国产盗摄x88av| ass极品水嫩小美女ass| 亚洲色婷婷一区二区三区| 男女全黄做爰文章| h色网站在线观看| 无码人妻一区二区三区在线视频| 天天爽天天爽天天爽| 免费看特级毛片| 亚洲欧洲国产视频| 中文视频在线观看| 亚洲熟妇无码av| 成人欧美一区二区三区黑人一| 国产福利在线导航| 不卡的一区二区| 久久人妻少妇嫩草av无码专区 | 中文字幕欧美激情极品| 免费观看特级毛片| 欧美极品jizzhd欧美仙踪林| www.自拍偷拍| 免费成人美女女在线观看| 欧美人与性动交α欧美精品|