跳到主要内容

京都大学 情報学研究科 知能情報学専攻 2024年8月実施 専門科目 S-2

Author

itsuitsuki

Description

We consider a problem of classifying a three-dimensional vector, where a value of each element is either 0 or 1, into either the class 1 or the class 2. Let x=(x(1),x(2),x(3)){0,1}3\boldsymbol{x} = (x(1), x(2), x(3)) \in \{0, 1\}^3 be a vector. Assume that each element of x\boldsymbol{x} of the class y=ky=k (k{1,2}k \in \{1, 2\}) independently follows a Bernoulli distribution, and let p(x(j)=1y=k)=μ(k)(j)p(x(j) = 1 | y = k) = \mu^{(k)}(j) (0μ(k)(j)1, j{1,2,3}0 \le \mu^{(k)}(j) \le 1, \ j \in \{1, 2, 3\}) be the probability of x(j)=1x(j) = 1. Let μ(k)=(μ(k)(1),μ(k)(2),μ(k)(3))\boldsymbol{\mu}^{(k)} = (\mu^{(k)}(1), \mu^{(k)}(2), \mu^{(k)}(3)) be parameters of the class kk.

Let D={(x1,y1),(x2,y2),,(xN,yN)}\mathcal{D} = \{(\boldsymbol{x}_1, y_1), (\boldsymbol{x}_2, y_2), \dots, (\boldsymbol{x}_N, y_N)\} be a data set consisting of NN data. Let xi=(xi(1),xi(2),xi(3))\boldsymbol{x}_i = (x_i(1), x_i(2), x_i(3)) be the vector of the ii-th data, and yiy_i be the class of xi\boldsymbol{x}_i. We assume that xi (i{1,,n})\boldsymbol{x}_i \ (i \in \{1, \dots, n\}) of the class yi=ky_i = k is independently observed from the aforementioned distribution whose parameter is μ(k)\boldsymbol{\mu}^{(k)}.

(1) Let p(y=k)p(y = k) be a prior probability for the class kk. We determine an estimated class y^\hat{y} of x\boldsymbol{x} by comparing the posterior probabilities. Namely, we set y^=1\hat{y} = 1 if p(y=1x)p(y=2x)p(y = 1 | \boldsymbol{x}) \ge p(y = 2 | \boldsymbol{x}); otherwise we set y^=2\hat{y} = 2. Show a rule that assigns x\boldsymbol{x} to an estimated class y^\hat{y} by using p(y=k)p(y = k) and μ(k)(j)\mu^{(k)}(j).

(2) Let D(k)={(xi,yi)Dyi=k} (k{1,2})\mathcal{D}^{(k)} = \{(\boldsymbol{x}_i, y_i) \in \mathcal{D} \mid y_i = k\} \ (k \in \{1, 2\}) be a subset of the data set D\mathcal{D}. By using D(k)\mathcal{D}^{(k)}, derive the maximum likelihood estimate μ^(k)\hat{\boldsymbol{\mu}}^{(k)} of μ(k)\boldsymbol{\mu}^{(k)} from the data set D\mathcal{D}.

(3) Assume that a data set D\mathcal{D} is given in Table 1. Compute the values of the maximum likelihood estimates μ^(k) (k{1,2})\hat{\boldsymbol{\mu}}^{(k)} \ (k \in \{1, 2\}) from Table 1.

Table 1: A data set

iixi\boldsymbol{x}_iyiy_i
1(1,0,0)(1, 0, 0)1
2(1,0,1)(1, 0, 1)1
3(1,1,0)(1, 1, 0)2
4(0,1,0)(0, 1, 0)1
5(0,0,1)(0, 0, 1)2

(4) Let prior probabilities be p(y=1)=35p(y = 1) = \frac{3}{5} and p(y=2)=25p(y = 2) = \frac{2}{5}. Compute the estimated class y^\hat{y} of x=(1,1,1)\boldsymbol{x} = (1, 1, 1) by substituting μ^(k)\hat{\boldsymbol{\mu}}^{(k)} computed in (3) for μ(k)\boldsymbol{\mu}^{(k)} of the rule shown in (1).

(5) Let a prior probability p(y=1)p(y = 1) be q (0q1)q \ (0 \le q \le 1). We classify x=(1,1,1)\boldsymbol{x} = (1, 1, 1) by substituting μ^(k)\hat{\boldsymbol{\mu}}^{(k)} computed in (3) for μ(k)\boldsymbol{\mu}^{(k)} of the rule shown in (1). Explain the relation between qq and an estimated class y^\hat{y}.

题目描述

考虑把三维二元向量 x=(x(1),x(2),x(3))\boldsymbol{x}=(x^{(1)},x^{(2)},x^{(3)}) 分类到类别 y{1,2}y\in\{1,2\} 的问题。给定类别 kk 时,各分量相互独立且服从 Bernoulli 分布:

p(x(j)=1y=k)=μj(k),j=1,2,3.p(x^{(j)}=1\mid y=k)=\mu_j^{(k)},\qquad j=1,2,3.

现有数据集 D={(xi,yi)}\mathcal{D}=\{(\boldsymbol{x}_i,y_i)\},回答下列问题。

  1. 使用类别先验概率以及参数 μ(k)\boldsymbol{\mu}^{(k)},推导比较后验概率的分类规则;若两个类别的后验概率相同,则规定分类为类别 1。

  2. 对每一个类别的样本子集,推导各参数 μj(k)\mu_j^{(k)} 的最大似然估计量。

  3. 对下表数据计算两个类别的参数估计 μ^(1)\hat{\boldsymbol{\mu}}^{(1)}μ^(2)\hat{\boldsymbol{\mu}}^{(2)},并计算第(1)问所需的分类规则:

    iixi\boldsymbol{x}_iyiy_i
    1(1,0,0)(1,0,0)1
    2(1,0,1)(1,0,1)1
    3(1,1,0)(1,1,0)2
    4(0,1,0)(0,1,0)1
    5(0,0,1)(0,0,1)2
  4. 令先验概率 p(y=1)=35p(y=1)=\frac35p(y=2)=25p(y=2)=\frac25,把第(3)问求得的参数估计代入第(1)问的规则,求 x=(1,1,1)\boldsymbol{x}=(1,1,1) 的预测类别 y^\hat y

  5. 改令 p(y=1)=qp(y=1)=q,其中 0q10\leq q\leq1。仍使用第(3)问的参数估计对 x=(1,1,1)\boldsymbol{x}=(1,1,1) 分类,说明 qq 与预测类别 y^\hat y 之间的关系。

考点

  • Bernoulli 朴素贝叶斯分类:由条件独立假设分解类条件似然,并结合先验概率比较后验概率。
  • Bernoulli 参数的最大似然估计:按类别统计每个二元特征取 1 的频率。
  • 先验敏感性与零概率现象:代入稀疏样本估计,分析分类结论随类别先验变化的分段关系。