首页
网站开发
桌面应用
管理软件
微信开发
App开发
嵌入式软件
工具软件
数据采集与分析
其他
首页
>
> 详细
COMS 4771程序讲解、辅导R编程语言、R程序调试 辅导R语言编程|讲解数据库SQL
项目预算:
开发周期:
发布时间:
要求地区:
COMS 4771 SP21 HW2
Due: Mon Feb 22, 2021 at 11:59pm
This homework is to be done alone. 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 your peers, but you must write your own individual solutions and not share
your written work/code. You must cite all resources (including online material, books, articles, help
taken from specific individuals, etc.) you used to complete your work.
1 Cost-sensitive classification
Suppose you have a binary classification problem with input space X = R and output space
Y = {0, 1}, where it is c times as bad to commit a “false positive” as it is to commit a “false negative”
(for some real number c ≥ 1). To make this concrete, let’s say that if your classifier predicts 1
but the correct label is 0, you incur a penalty of $c; if your classifier predicts 0 but the correct label
is 1, you incur a penalty of $1. (And you incur no penalty if your classifier predicts the correct label.)
Assume the distribution you care about has a class prior with π0 = 2/3 and π1 = 1/3, and the
class conditional are Gaussians with densities N(0, 1) for class 0, and N(2, 1/4) for class 1. Let f∗: R → {0, 1} be the classifier with the smallest expected penalty.
(i) Assume 1 ≤ c ≤ 14. Specify precisely the subset of R in which the classifier f
∗ predicts 1.
(E.g., [0, 5c] ∪ [6c, +∞).)
(ii) Now instead assume c ≥ 15. Again, specify precisely the region in which the classifier f
∗
predicts 1.
2 Making data linearly separable by feature space mapping
Consider the infinite dimensional feature space mapping
Φσ : R → R.
(It may be helpful to sketch the function f(α) := max{0, 1 − |α|} for understanding the mapping
and answering the questions below)
(i) Show that for any n distinct points x1, . . . , xn, there exists σ > 0 such that the mapping Φσ
can linearly separate any binary labeling of the n points.
1
(ii) Show that one can efficiently compute the dot products in this feature space, by giving an
analytical formula for Φσ(x) · Φσ(x0) for arbitrary points x and x0.
3 Learning DNFs with kernel perceptron
Suppose that we have S = {(x(i), y(i))}ni=1 with x
(i) ∈ {0, 1}d
and y(i) ∈ {−1, 1}. Let ϕ :{0, 1}
d → {0, 1} be a “target function” which “labels” the points. Additionally assume that ϕ is
a DNF formula (i.e. ϕ is a disjunction of conjunctions, or a boolean “or” of a bunch of boolean
“and”s). The fact that it “labels” the points simply means that 1[y
(i) = 1] = ϕ(x(i)).
For example, let ϕ(x) = (x1 ∧ x2) ∨ (x1 ∧ x¯2 ∧ x3) (where xi denotes the ith entry of x),
(i) Give an example target function ϕ (make sure its a DNF formula) and set S such that the data
is not linearly separable.
Part (i) clearly shows that running the perceptron algorithm on S cannot work in general since the
data does not need to be linearly separable. However, we can try to use a feature transformation and
the kernel trick to linearize the data and thus run the kernelized version of the perceptron algorithm
on these datasets.
Consider the feature transformation φ : {0, 1}
d → {0, 1}3d
which maps a vector x to the vector
of all the conjunctions of its entries or of their negations. So for example if d = 2 then φ(x) =1 x1 x2 x¯1 x¯2 x1 ∧ x2 x1 ∧ x¯2 x¯1 ∧ x2 x¯1 ∧ x¯2T
(note that 1 can be viewed as the
empty conjunction, i.e. the conjunction of zero literals).
Let K : {0, 1}
d × {0, 1}
d → R be the kernel function associated with φ (i.e. for a, b ∈ {0, 1}
d:K(a, b) = φ(a) · φ(b)).
(ii) Find a way to compute K(a, b) in O(d) time.
(iii) Show that w∗
linearly separates φ(S) (φ(S) is just a shorthand for {(φ(x
(i)), y(i))}ni=1) and
find a lower bound for the margin γ with which it separates the data. Remember that γ =
min(φ(x(i)),y(i))∈φ(S) yi. Your lower bound should depend on s, the number
of conjunctions in ϕ.
(iv) Find an upper bound on the radius R of the dataset φ(S). Remember that
R = max
(φ(x(i)),y(i))∈φ(S)kφ(x(i))k.2
(v) Use parts (ii), (iii), and (iv) to show that we can run kernel perceptron efficiently on this transformed
space in which our data is linearly separable (show that each iteration takes O(nd)
time only) but that unfortunately the mistake bound is very bad (show that it is O(s2d)).
There are ways to get a better mistake bound in this same kernel space, but the running time then
becomes very bad (exponential). It is open whether there are ways to get both polynomial mistake
bound and running time.
4 Understanding model complexity and overfitting
Here we will empirically study the tradeoff between model complexity and generalizability using
handwritten digits dataset.
Download the datafile digits.mat. This datafile contains 10,000 images (each of size 28x28
pixels = 784 dimensions) of handwritten digits along with the associated labels. Each handwritten
digit belongs to one of the 10 possible categories {0, 1, . . . , 9}. There are two variables in this
datafile: (i) Variable X is a 10,000x784 data matrix, where each row is a sample image of a handwritten
digit. (ii) Variable Y is the 10,000x1 label vector where the i
th entry indicates the label of
the i
th sample image in X.
Special note for those who are not using Matlab: Python users can use scipy to read in the mat file,
R users can use R.matlab package to read in the mat file, Julia users can use JuliaIO/MAT.jl.
Octave users should be able to load the file directly.
To visualize this data (in Matlab): say you want to see the actual handwritten character image of the
77th datasample. You may run the following code (after the data has been loaded):
figure;
imagesc(1-reshape(X(77,:),[28 28])’);
colormap gray;
To see the associated label value:
Y(77)
(i) Build a decision tree classifier for the handwritten digit dataset. In building your decision
tree, you may use any reasonable uncertainty measure to determine the feature and threshold
to split at in each cell. Make sure the depth of the tree is adjustable with hyperparameter K.
You must submit your code to receive full credit.
(ii) Ensure that there is a random split between training and test data. Plot the training error and
test error as a function of K.
(iii) Do the trends change for different random splits of training and test data?
(iv) How do you explain the difference in the behavior of training and testing error as a function
of K?
(v) Based on your analysis, what is a good setting of K if you were deploy your decision tree
classifier to classify handwritten digits?
3
软件开发、广告设计客服
QQ:99515681
邮箱:99515681@qq.com
工作时间:8:00-23:00
微信:codinghelp
热点项目
更多
代做ceng0013 design of a pro...
2024-11-13
代做mech4880 refrigeration a...
2024-11-13
代做mcd1350: media studies a...
2024-11-13
代写fint b338f (autumn 2024)...
2024-11-13
代做engd3000 design of tunab...
2024-11-13
代做n1611 financial economet...
2024-11-13
代做econ 2331: economic and ...
2024-11-13
代做cs770/870 assignment 8代...
2024-11-13
代写amath 481/581 autumn qua...
2024-11-13
代做ccc8013 the process of s...
2024-11-13
代写csit040 – modern comput...
2024-11-13
代写econ 2070: introduc2on t...
2024-11-13
代写cct260, project 2 person...
2024-11-13
热点标签
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
联系我们
- QQ: 9951568
© 2021
www.rj363.com
软件定制开发网!