Starting from:

$30

Machine Learning Homework 2 -Solved


I. Pen-and-paper [13v] 
Four positive observations, {(๐ด
0) , (๐ต
1) , (๐ด1) , (๐ด
0)}, and four negative observations, {(๐ต
0) , (๐ต
0) , (๐ด1) , (๐ต
1)}, 
were collected. Consider the problem of classifying observations as positive or negative. 
1) [4v] Compute the recall of a distance-weighted ๐‘˜NN with ๐‘˜ = 5 and distance ๐‘‘(๐ฑ1, ๐ฑ2) = 
๐ป๐‘Ž๐‘š๐‘š๐‘–๐‘›๐‘”(๐ฑ1, ๐ฑ2)+
1

using leave-one-out evaluation schema (i.e., when classifying one 
observation, use all remaining ones). 
An additional positive observation was acquired, (๐ต
0), and 

third 
variable 
๐‘ฆ

was 
independently 
monitored, yielding estimates ๐‘ฆ3|๐‘ƒ = {1.2, 0.8, 0.5, 0.9,0.8

and 
๐‘ฆ
3|๐‘ = {
1

0
.9, 1
.
2, 0.8}. 
2) [4v] Considering the nine training observations, learn a Bayesian classifier assuming: 
i) ๐‘ฆ1 and ๐‘ฆ2 are dependent, ii) {๐‘ฆ1, ๐‘ฆ2} and {๐‘ฆ3} variable sets are independent and equally 
important, and ii) ๐‘ฆ3 is normally distributed. Show all parameters. 
Considering three testing observations, {((0๐ด1
.8) , Positive
) ,(
(
๐ต
1
1


Positive

,
(

๐ต
0
0
.9

,
Negative
)}. 
3) [3v] Under a MAP assumption, compute 
๐‘ƒ
(Positive
|๐ฑ

of 
each 
testing 
observation. 
4) [2v] Given a binary class variable, the default 
decision 
threshold 
of 
๐œƒ 

0
.5

๐‘“(๐ฑ|๐œƒ) = { 
Positive ๐‘ƒ(Positive
|๐ฑ) > 
๐œƒ 
Negative 
otherwise 
can be adjusted. Which decision threshold 
– 0.3, 0.5 or 
0.7 – optimizes 
testing accuracy? 
II. Programming and critical analysis [7v] 
Considering the pd_speech.arff dataset available at the course webpage. 
5) [3v] Using sklearn, considering 

10
-fold 
stratified 
cross 
validation 
(random=0
), plot 
the 
cumulative 
testing confusion matrices of 
๐‘˜NN 
(uniform 
weights, 
๐‘˜ = 
5, Euclidean 
distance) 
and 
Naïve 
Bayes 
(Gaussian assumption). Use all 
remaining 
classifier 
parameters 
as default. 
6) [2v] Using scipy, test the hypothesis “๐‘˜NN is statistically superior to Naïve Bayes regarding 
accuracy”, asserting whether is true. 
7) [2v] Enumerate three 
possible 
reasons 
that 
could underlie the observed differences in predictive 
accuracy between 
๐‘˜NN 
and Naïve 
Bayes. 
END

More products