本次Assignment辅导主要是Computer Science相关的python机器学习
ELEC6008 Pattern recognition and machine learning (2020-2021)
Written Assignment: 100 marks
(Counts towards 15% of the overall assessment)
ELEC6008模式识别和机器学习(2020-2021)
书面作业:100分
(占总评估的15%)
回答所有问题。 Q1。
(a)相对于x的两个类别1和2的可能性由(x + 2)2(x-5)2给出
p(x |1)= 1 e-2和p(x |2)= 1 1 e-8。 222
(小计:18)这两个类别的先验概率由下式给出:
P(1)= 0.8和P(2)= 0.2。
i)找到最大似然分类器。
(5分)
ii)使用贝叶斯规则P(i| x)= p(x |i)P(i),找到两个p(x)的分类器
类。 (如果决策边界不止一个,那么您也应该找到它们)
(5分)
客户X希望将以上分类器应用于生物医学应用,并建议对贝叶斯分类采用以下损失函数:
实际上是10
1个
其实是2 5
0
选择1选择2
iii)记下损失函数(1|1),(1|2),(2|1)和(2|2)的4个不同值。
(2分)
iv)使用(iii)中的新损失函数找到贝叶斯最低风险分类器。
(4分)
v)建议并解释(iv)中的新分类器是否仍然是最小错误率分类器。
(2分)
(b)考虑以下准则函数,以找到一个超平面来分离两类样本,它们包含x1 = [4,1] T,x2 = [3,2] T(类别1)和
x3 = [6,8] T,x4 = [9,9] T(第2类),
Jq(a)=-aTy。 (小计:15)
i)梯度下降可用于求解Jq(a)。写下表达式
根据(k),aJq(a),a(k + 1)和a(k)进行迭代求解。
(2分)
ii)假设将增强的特征向量定义为y = [1,x1,x2] T。使用(i)和(ii),通过初始化a(1)= [0,0,0] T和astepsize( k)= 1。
(6分)
iii)学生Y建议应采用软利润支持向量机,而不是
2N
感知器,以min w +Cmax(0,1-z(wTx + w))的形式给出,
zi = 1,-1。使用初始化w = [w0,w] = [0,0,0]
(k)= 0.1并且正则化参数C = 10,求出w〜(2)和w〜(3)。
〜
w,w0,i2 i = 1
〜(1)(1)(1)T T T
ii0
, 步长
(7分)
Q2。
(a)设密度函数参数的似然为
4
/ 25 / 2×4 exp(−x2)0
i)给定一组
确定likelihood的最大似然。
p(x |)=3
x0否则
。
(小计:16)
{x1,x2,x3,x4} = {2,5,7,11},(6个标记)
独立的
假设参数具有先验概率
p()= 0.5 [(− 2)+(− 3)],
(。)是理想单位脉冲函数,非正式定义为:
(y)=y= 0且and(y)= 1。 0否则-
ii)确定后验概率p(| x1,x2,x3,x4)。 iii)找到的最大后验(MAP)估计。
(6分)(4分)
iii)使用kn = 3的kNN方法找到x = 4.5的p(x)。
(1分)
(5分)
特征样本
(b)考虑以下独立抽取的样本
X = {1,2,2,4,5,7,8,9,9},N = 9(小计:17)
i)使用Parzen窗口,对于x = 4.5,使用矩形窗口,找到带宽为hd = 2的p(x)。
(5分)
ii)Silverman规则是一种选择带宽的方法。建议在什么情况下确定的带宽是最佳的。
iv)假设X 1 = [1,1,3,4,5,5]和X 2 = [8,9,9,11,12,12]分别属于第1类和第2类,则建议哪个类做一个如果使用kn = 3的kNN方法,则x = 7属于任意值。
(5分)
vi)解释为什么在两类分类问题中不应使用偶数kn。
(1分)
Answer ALL questions. Q1.
(a) Let the likelihood of the two classes 1 and 2 with respect to x be given by (x+2)2 (x−5)2
p(x|1)= 1 e− 2 and p(x|2)= 1 e− 8 . 2 2 2
(Sub-total: 18) The a priori probabilities for the two classes are given by
P(1)=0.8and P(2)=0.2.
i) Find the Maximum Likelihood Classifier .
(5 marks)
ii) Using the Bayes rule P(i | x) = p(x |i )P(i ) , find the classifier(s) for the two p(x)
classes. (If there are more than one decision boundaries, you should find them as well)
(5 marks)
Client X wants to apply the above classifier for bio-medical applications and has suggested the following loss functions for Bayes classification:
is actually1 0
1
is actually2 5
0
choosing 1 choosing 2
ELEC6008 Written Assignment
iii) Write down the 4 different values of the loss function (1 |1), (1 |2), (2 |1)and (2 |2).
(2 mark)
iv) Find the Bayes Minimum Risk Classifier using the new loss function in (iii).
(4 marks)
v) Suggest and explain whether the new classifier in (iv) is still a minimum error rate classifier.
(2 marks)
(b) Consider the following criterion function for finding a hyperplane to separate the two classes of samples, which contain x1 =[4,1]T , x2 =[3,2]T (Class 1) and
x3 = [6,8]T , x4 =[9,9]T (Class 2),
Jq(a)= −aT y. (Sub-total:15)
yYC
i) The Gradient Descent can be used to solve Jq (a). Write down the expression
in terms of (k) , a Jq (a), a(k+1) and a(k) that solves a iteratively.
(2 marks)
ii)Supposetheaugmentedfeaturevectorisdefinedas y=[1,x1,x2]T .Using(i)and (ii),find a(2) and a(3) withaninitialization a(1) =[0,0,0]T andastepsize (k) =1.
(6 marks)
iii) Student Y suggests the soft-margin SVM should be employed rather than the
2N
perceptron, which is given as min w +Cmax(0,1−z(wTx+w)),
zi = 1,−1 . Using an initialization w = [w0 , w ] = [0,0,0]
( k ) = 0.1 and regularization parameter C = 10 , find w~ ( 2 ) and w~ ( 3 ) .
ELEC6008 Written Assignment
pg 2 of 5
~
w,w0 ,i 2 i=1
~(1) (1) (1)T T T
ii0
, step size
(7 marks)
Q2.
(a) Let the likelihood of a parameter of the density function given as
4
5/2×4 exp(−x2) 0
i) Given a set of
determine the maximum likelihood of .
p(x|)=3
x0 otherwise
.
(Sub-total:16)
{x1 , x2 , x3 , x4 } = {2,5,7,11} , (6 marks)
independent
Assume that the parameter has an a priori probability
p( ) = 0.5[ ( − 2) + ( − 3)] ,
where (.) is the ideal unit impulse function informally defined as:
(y)= y=0 and (y)=1. 0 otherwise −
ii) Determine the posterior probability p( | x1 , x2 , x3 , x4 ) . iii) Find the Maximum A Posteriori (MAP) Estimate of .
(6 marks) (4 marks)
iii) Find p(x) for x = 4.5 using the kNN method with kn = 3 .
(1 mark)
(5 marks)
feature samples
(b) Consider the following independently drawn samples
X = {1,2,2,4,5,7,8,9,9} , N = 9 (Sub-total: 17)
i) Find p(x) for x = 4.5 using the Parzen window with a bandwidth hd = 2 using the rectangular window.
(5 marks)
ii) The Silverman’s Rule is a method to choose the bandwidth. Suggest under what situation the determined bandwidth is optimal.
iv) Suppose X 1 = [1,1,3,4,5,5] and X 2 = [8,9,9,11,12,12] belongs to class 1 and class 2 respectively, suggest which class does an arbitrary value x = 7 belongs to if the kNN method with kn = 3 is used.
(5 marks)
vi) Explain why an even kn should not be used in a two-class classification problem.
(1 mark)
ELEC6008 Written Assignment pg 3 of 5