京都大学 情報学研究科 知能情報学専攻 2025年8月実施 専門科目 S-2
Author
itsuitsuki
Description
大学公表の原題
Let us consider a binary classification problem in which a real-valued vector X in a d-dimensional space is classified into a class y∈{0,1}. The boundary between class 0 and class 1 in this space defined by a classification method is referred to as the decision boundary.
Q.1
Let P0 be a prototype vector of class 0 and P1 be a prototype vector of class 1, and consider a method to classify X into the class with a smaller squared distance between its prototype vector and X. Derive an equation of the decision boundary and show whether it is linear or not. Here we assume P0=P1.
Q.2
Assume that class 0 follows a multi-variate normal distribution with a mean vector M0 and a covariance matrix Σ, and that class 1 follows a normal distribution with a mean vector M1 and the same covariance matrix Σ. Then, we consider a method to classify X into the class with a larger likelihood for X. Derive an equation of the decision boundary and show whether it is linear or not. Here we assume that there exists an inverse matrix of Σ, and M0=M1.
Q.3
Consider a method that models the posterior probability of class 1 given X, p(y=1∣X), with the standard sigmoid function of the inner product W⋅X, where W is a weight parameter vector. Derive the logarithm of the ratio of the posterior probabilities of class 0 and class 1, and show whether it is linear or not.
Q.4
In the method of Q.3, let us define the loss function with the binary cross-entropy of the posterior probabilities of class 0 and class 1. Derive its gradient with respect to the weight parameter W by showing the derivation process.
Q.5
Describe a method to extend the method of Q.3 and Q.4 to a multi-class classification problem. Specifically, show a function to compute the posterior probability of class i and a loss function, together with its gradient with respect to the weight parameter. You do not have to show the derivation process.
Q.6
Briefly describe a method to extend the method of Q.5 to a multi-layer feed-forward neural network. Specifically, show an activation function used in each layer and a loss function, together with a method to compute the gradients with respect to the weight parameters.
题目描述
考虑二分类问题:把 d 维空间中的实向量 X 分类到 y∈{0,1}。某分类方法在该空间中划分类别 0 与类别 1 的边界称为决策边界。
-
设 P0,P1 分别是类别 0、1 的原型向量。把 X 分到其原型与 X 的平方距离较小的类别。推导决策边界方程,并说明该边界是否为线性边界。假设 P0=P1。
-
假设类别 0 服从均值向量为 M0、协方差矩阵为 Σ 的多元正态分布,类别 1 服从均值向量为 M1、协方差矩阵同为 Σ 的多元正态分布。采用把 X 分到对它具有较大似然的类别的方法。推导决策边界方程,并说明其是否为线性边界。假设 Σ 可逆且 M0=M1。
-
考虑用内积 W⋅X 的标准 sigmoid 函数建模后验概率 p(y=1∣X),其中 W 是权重参数向量。推导类别 0 与类别 1 后验概率之比的对数,并说明它是否为线性函数。
-
在第 3 问的方法中,以类别 0、1 后验概率的二元交叉熵定义损失函数。写出推导过程,求该损失关于权重参数 W 的梯度。
-
说明如何把第 3、4 问的方法扩展到多分类问题。具体给出类别 i 的后验概率函数、损失函数,以及损失对权重参数的梯度;本问无需写推导过程。
-
简要说明如何把第 5 问的方法扩展为多层前馈神经网络。具体给出各层使用的激活函数和损失函数,并说明计算各权重参数梯度的方法。
Kai
Q.1
边界满足 ∥X−P0∥2=∥X−P1∥2。展开并消去 XTX,得到
2(P1−P0)TX=∥P1∥2−∥P0∥2.
因 P0=P1,这是一个仿射超平面,故为线性决策边界。
Q.2
两个高斯密度的行列式因子相同,故比较似然等价于比较 Mahalanobis 距离。令两似然相等,得到
(X−M0)TΣ−1(X−M0)=(X−M1)TΣ−1(X−M1).
展开后为
2(M1−M0)TΣ−1X=M1TΣ−1M1−M0TΣ−1M0.
可逆协方差矩阵为正定矩阵,且两个均值不同,因此该边界也是仿射超平面。
Q.3
记 z=W⋅X、p=σ(z)=1/(1+e−z)。则
logp(y=1∣X)p(y=0∣X)=logp1−p=−z=−W⋅X,
是 X 的线性函数。
Q.4
单个样本标签为 y∈{0,1} 时,二元交叉熵为
ℓ=−ylogp−(1−y)log(1−p).
利用 σ′(z)=p(1−p),
∂z∂ℓ=(−py+1−p1−y)p(1−p)=p−y,
所以 ∇Wℓ=(p−y)X。多个样本的平均损失取上述梯度的样本平均。
Q.5
设有 K 类,yi 是 one-hot 标签,使用 softmax:
pi=∑j=1KeWj⋅XeWi⋅X,ℓ=−∑i=1Kyilogpi.
其梯度为 ∇Wiℓ=(pi−yi)X。
Q.6
令 h(0)=X,隐藏层取
z(l)=W(l)h(l−1)+b(l),h(l)=ReLU(z(l)),
其中 ReLU(z)=max(0,z) 按元素作用。输出层对 logits z(L) 使用 softmax,损失仍取多类交叉熵。反向传播按链式法则计算
δ(L)=p−y,δ(l)=((W(l+1))Tδ(l+1))⊙ReLU′(z(l)),
∂W(l)∂ℓ=δ(l)(h(l−1))T,∂b(l)∂ℓ=δ(l).
在 ReLU 的零点可约定使用次梯度 0。随后以梯度下降等方法更新参数。