代写COMS 4771、代做R编程语言、代写SU19 HW1、代做R语言 代做留学生Prolog|帮做Java程序
COMS 4771 SU19 HW1
Due: Sun Jul 21, 2019 at 11:59pm
You are allowed to write up solutions in groups of (at max) two students. These group members
don’t necessarily have to be the same from previous homeworks. Only one submission per group
is required by the due date on Gradescope. Name and UNI of all group members must be clearly
specified on the homework. No late homeworks are allowed. To receive credit, a typesetted copy of
the homework pdf must be uploaded to Gradescope by the due date. You must show your work to
receive full credit. Discussing possible solutions for homework questions is encouraged on piazza
and with peers outside your group, but every group must write their own individual solutions. You
must cite all external references you used (including the names of individuals you discussed the
solutions with) to complete the homework.
1 [Statistical Estimators] Here we will study some statistical estimators.
(i) Given a, b ∈ R s.t. a < b, consider the density p(x | θ = (a, b)) ∝
n
1 if a ≤ x ≤ b
0 otherwise .
Suppose that n samples x1, . . . , xn are drawn i.i.d. from p(x|θ). What is the Maximum
Likelihood Estimate (MLE) of θ given the samples?
(ii) Show that for the MLE θML of a parameter θ ∈ R
d
and any known injective function
g : R
d → R
k
, the MLE of g(θ) is g(θML).
(iii) For a 1-dimensional Gaussian distribution, give two examples for each of the following
types of estimators for the mean parameter.
– consistent and unbiased.
– consistent, but not unbiased.
– not consistent, but unbiased.
– neither consistent, nor unbiased.
2 [Universality of Decision Trees]
(i) Show that any binary classifier g : {0, 1}
D → {0, 1} can be implemented as a decision
tree classifier. That is, for any classifier g there exists a decision tree classifier T with k
nodes n1, . . . , nk (each ni with a corresponding threshhold ti), such that g(x) = T(x)
for all x ∈ {0, 1}
D.
(ii) What is the best possible bound one can give on the maximum height of such a decision
tree T (from part (i))? For what function g is the bound tight?
13 [Designing the optimal predictor for continuous output spaces] We studied in class that
the “Bayes Classifier”
f := arg maxy P[Y |X]
is optimal in the sense that it minimizes
generalization error over the underlying distribution, that is, it maximizes Ex,y[1[g(x) = y]].
But what can we say when the output space Y is continuous?
Consider predictors of the kind g : X → R that predict a real-valued output for a given input
x ∈ X . One intuitive way to define the quality of of such a predictor g is as
Q(g) := Ex,y[(g(x)y)2].
Observe that one would want a predictor g with the lowest Q(g).
(i) Show that if one defines the predictor as f(x) := E[Y |X = x], then Q(f) ≤ Q(g) for
any g, thereby showing that f is the optimal predictor with respect to Q for continuous
output spaces.
(ii) If one instead defines quality as Q(g) := Ex,y
|g(x) y|, which f is the optimal
predictor? Justify your reasoning.
4 [Finding (local) minima of generic functions] Finding extreme values of functions in a
closed form is often not possible. Here we will develop a generic algorithm to find the extremal
values of a function. Consider a smooth function f : R → R.
(i) Recall that Taylor’s Remainder Theorem states:
For any a, b ∈ R, exists z ∈ [a, b], such that f(b) = f(a)+f
Assuming that there exists L ≥ 0 such that for all a, b ∈ R, |f0(a)f0
(b)| ≤ L|a ? b|,
prove the following statement:
For any x ∈ R, there exists some η > 0, such that if xˉ := x?ηf0
(x), then f(ˉx) ≤ f(x),
with equality if and only if f
0
(x) = 0.
(Hint: first show that the assumption implies that f has bounded second derivative, i.e.,
f
00(z) ≤ L (for all z); then apply the remainder theorem and analyze the difference
f(x) ? f(ˉx)).
(ii) Part (i) gives us a generic recipe to find a new value xˉ from an old value x such that
f(ˉx) ≤ f(x). Using this result, develop an iterative algorithm to find a local minimum
starting from an initial value x0.
(iii) Use your algorithm to find the minimum of the function f(x) := (x ? 4)2 + 2e
x
. You
should code your algorithm in a scientific programming language like Matlab to find the
solution.
5 [Email spam classification case study] Download the datafile hw1data.tar.gz. This datafile
contains email data of around 5,000 emails divided in two folders ‘ham’ and ‘spam’ (there are
about 3,500 emails in the ‘ham’ folder, and 1,500 emails in the ‘spam’ folder). Each email is
a separate text file in these folders. These emails have been slightly preprocessed to remove
meta-data information.
(i) (Embedding text data in Euclidean space) The first challenge you face is how to systematically
embed text data in a Euclidean space. It turns out that one successful way
2of transforming text data into vectors is via “Bag-of-words” model. Basically, given a
dictionary of all possible words in some order, each text document can be represented as
a word count vector of how often each word from the dictionary occurs in that document.
Example: suppose our dictionary D with vocabulary size 10 (|D| = 10). The words
(ordered in say alphabetical order) are:
1: also
2: football
3: games
4: john
5: likes
6: Mary
7: movies
8: to
9: too
10: watch
Then any text document created using this vocabulary can be embedded in R
|D| by
counting how often each word appears in the text document.
Say, an example text document t is:
John likes to watch football. Mary likes movies.
Then the corresponding word count vector in |D| = 10 dimensions is:
[ 0 1 0 1 2 1 1 1 0 1]
(because the word “also” occurs 0 times, “football” occurs 1 time, etc. in the document.)
While such an embedding is extremely useful, a severe drawback of such an embedding
is that it treats similar meaning words (e.g. watch, watches, watched, watching, etc.) independently
as separate coordinates. To overcome this issue one should preprocess the
entire corpus to remove the common trailing forms (such as “ing”, “ed”, “es”, etc.) and
get only the root word. This is called word-stemming.
Your first task is to embed the given email data in a Euclidean space by: first performing
word stemming, and then applying the bag-of-words model.
Some useful references:
– Bag-of-words: http://en.wikipedia.org/wiki/Bag-of-words model
– Word stemming: http://en.wikipedia.org/wiki/Stemming
(ii) Once you have a nice Euclidean representation of the email data. Your next task is to
develop a spam classifier to classify new emails as spam or not-spam. You should
compare performance of naive-bayes, nearest neighbor (with L1, L2 and L∞ metric)
and decision tree classifiers.
(you may use builtin functions for performing basic linear algebra and probability calculations
but you should write the classifiers from scratch.)
You must submit your code to Courseworks to receive full credit.
3(iii) Which classifier (discussed in part (ii)) is better for the email spam classification dataset?
You must justify your answer with appropriate performance graphs demonstrating the
superiority of one classifier over the other. Example things to consider: you should
evaluate how the classifier behaves on a holdout ‘test’ sample for various splits of the
data; how does the training sample size affects the classification performance.
4

热门主题

课程名

mktg2509 csci 2600 38170 lng302 csse3010 phas3226 77938 arch1162 engn4536/engn6536 acx5903 comp151101 phl245 cse12 comp9312 stat3016/6016 phas0038 comp2140 6qqmb312 xjco3011 rest0005 ematm0051 5qqmn219 lubs5062m eee8155 cege0100 eap033 artd1109 mat246 etc3430 ecmm462 mis102 inft6800 ddes9903 comp6521 comp9517 comp3331/9331 comp4337 comp6008 comp9414 bu.231.790.81 man00150m csb352h math1041 eengm4100 isys1002 08 6057cem mktg3504 mthm036 mtrx1701 mth3241 eeee3086 cmp-7038b cmp-7000a ints4010 econ2151 infs5710 fins5516 fin3309 fins5510 gsoe9340 math2007 math2036 soee5010 mark3088 infs3605 elec9714 comp2271 ma214 comp2211 infs3604 600426 sit254 acct3091 bbt405 msin0116 com107/com113 mark5826 sit120 comp9021 eco2101 eeen40700 cs253 ece3114 ecmm447 chns3000 math377 itd102 comp9444 comp(2041|9044) econ0060 econ7230 mgt001371 ecs-323 cs6250 mgdi60012 mdia2012 comm221001 comm5000 ma1008 engl642 econ241 com333 math367 mis201 nbs-7041x meek16104 econ2003 comm1190 mbas902 comp-1027 dpst1091 comp7315 eppd1033 m06 ee3025 msci231 bb113/bbs1063 fc709 comp3425 comp9417 econ42915 cb9101 math1102e chme0017 fc307 mkt60104 5522usst litr1-uc6201.200 ee1102 cosc2803 math39512 omp9727 int2067/int5051 bsb151 mgt253 fc021 babs2202 mis2002s phya21 18-213 cege0012 mdia1002 math38032 mech5125 07 cisc102 mgx3110 cs240 11175 fin3020s eco3420 ictten622 comp9727 cpt111 de114102d mgm320h5s bafi1019 math21112 efim20036 mn-3503 fins5568 110.807 bcpm000028 info6030 bma0092 bcpm0054 math20212 ce335 cs365 cenv6141 ftec5580 math2010 ec3450 comm1170 ecmt1010 csci-ua.0480-003 econ12-200 ib3960 ectb60h3f cs247—assignment tk3163 ics3u ib3j80 comp20008 comp9334 eppd1063 acct2343 cct109 isys1055/3412 math350-real math2014 eec180 stat141b econ2101 msinm014/msing014/msing014b fit2004 comp643 bu1002 cm2030
联系我们
EMail: 99515681@qq.com
QQ: 99515681
留学生作业帮-留学生的知心伴侣!
工作时间:08:00-21:00
python代写
微信客服:codinghelp
站长地图