

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Assigned: Oct 26, 2006
Due: Nov. 30, 2006
This assignment is work 40% of your final mark.
You are free to discuss this homework with anyone you like. However the assignment you hand in
must be your own. You must use Matlab!
You MUST use the template code in Template Code.zip for your assignment!
The density estimation algorithm you will be implementing is based on a classification algorithm developed
by Thomas Strohmann for his Ph.D. proposal. One motivation behind this algorithm is that it is intended to
be effective for very large problem domains.
Assume a set of N k
training example inputs from class k ∈ { 1 , ..., K}, labeled as {x
k
1
, ..., x
k
N k
}, where
x
k
j
= (x
k
j 1
, ..., x
k
jd
d , for all j = 1, ..., N k
(and d = 1, 2 , ...). Assume that these training examples are
generated i.i.d from a probability density function ( pdf ) h k
(x). We will estimate this pdf for class k using
the following mixture of Gaussians Model:
h k
(x) =
k
Nk ∑
j=
√
(2π)
d
∣
∣
∣
kj
∣
∣
∣
exp
[
(
x − x
k
j
) T
ˆ Σ
− 1
kj
(
x − x
k
j
)
]
where
Σkj is the covariance matrix of Gaussian j of class k,
− 1
kj
is its inverse, and |
− 1
kj
| is its determinant.
The covariance matrix
kj
is estimated using the Q nearest neighbors of x
k
j
in the training {x
k
1
, ..., x
k
Nk
For notational convenience, we label the points x
k
j
and its Q nearest neighbors as {p 1 , ..., pQ}, where
pq = (pq 1 , ..., pqd). Given {p 1 , ..., pQ}, we estimate
Σkj as:
kj
σ
2
kj 1
0 σ
2
kjd
where, ∀m ∈ { 1 , ..., d},
σ
2
kjm
= d [max {S min
, var (p m
min
var (p m
1
Q− 1
Q ∑
i=
(p im
− p¯ m
2
p ¯ m
1
Q
Q ∑
i=
p im
Given this simplified form for
kj
, we can write
h k
(x) as:
hk (x) =
k
N k ∑
j=
√
√
√
√ (2π)
d
(
d ∏
i=
σ
2
kji
)
exp
−
d ∑
i=
(
x
k
ji
− x i
) 2
σ
2
kji
For computational reasons, this equations is implemented as:
hk (x) =
1
N k
N ∑k
j=
{exp [Akj (x) − Bkj ]}
Akj (x) = −
1
2
d ∑
i=
(x
k
ji
−xi)
2
σ
2
kji
kj
d
2
log e
(2π) +
d ∑
i=
log e
(σ kji
The learning parameters Q > 1 and S min
0 are estimated using a validation set as defined below.
Given estimates of pdfs
hk(x) and prior class probabilities pˆk, we use the Bayes optimal classifier:
y ˆ = arg max
k∈{ 1 ,...,K}
{
p ˆ k
h k
(x)
}
where pˆ k
is the proportion of training data belonging to class k.
The training data {x
k
1
, ..., x
k
N k
} for each class is scaled such that each dimension has mean zero and a
standard deviation of one. THIS MEANS THAT BEFORE A TEST OR VALIDATION POINT x is applied
to
h k
(x), it must be scaled by the same scaling factors! To scale dimension x i
the following is used:
xi ⇐
x i
− x¯
k
i
sd
(
x
k
i
where x¯
k
i
is the mean value of dimension i in {x
k
1
, ..., x
k
N k
} and sd(x
k
i
) is its standard deviation.
Assume that, for each class there is a training set X
k
trn
= {x
k
1
, ..., x
k
Nk
}, and a validation set X
k
val
v x
k
1
v x
k
N
v
k
} consisting of N
v
k
points. The validation sets will be used to pick Q > 1 and Smin > 0.
This will be done by searching over Q ∈ { 5 , 15 , 25 , 35 }; for each value of Q, and choosing the best
min
∈ { 1 e − 10 , 1 e − 6 , 1 e − 2 }. The parameters Q and S min
will be chosen using Maximum Likelihood
as follows.
Maximizing the Likelihood of the Validation Data in the Class: The likelihood function of
h k
(x) on
the validation data X
k
val
v x
k
1
v x
k
N
v
k
} is given by:
(
h k
∣
∣
∣
(
v x
k
1
v x
k
N
v
k
) )
N
v
k ∏
t=
h k
(
v x
k
t
)