跳到主要内容

東京大学 情報理工学系研究科 創造情報学専攻 2017年8月実施 筆記試験 第1問

Author

tomfluff, 祭音Myyura, itsuitsuki

Description

A data set SS including eight data is given as in Figure 1. Each datum is in the form of (x1,x2,x3,x4,y){0,1}5(x_1, x_2, x_3, x_4, y) \in \{0, 1\}^5. Below we consider how to construct a rule from SS for classifying x=(x1,x2,x3,x4)\boldsymbol{x} = (x_1, x_2, x_3, x_4) into y=1y = 1 or y=0y = 0. Answer the following questions.

Figure 1: Data set

ttx1x_1x2x_2x3x_3x4x_4yy
110011
211001
310111
401101
500110
600100
700010
811100

(1) Let us consider the code-length required for encoding a binary string z=z1,,znz = z_1, \dots, z_n of length nn (zi{0,1},i=1,,nz_i \in \{0, 1\}, i = 1, \dots, n). In general, for a finite set GG, the code-length required for encoding one element gGg \in G is given by logG\log |G| (bit), where the logarithm is to the base 2. Show that, for a binary string zz of length nn in which the number of occurrences of 11 is kk, the code-length required for encoding zz and kk itself is at most:

log(n+1)+log nCk (bit),\begin{align} \log(n + 1) + \log \ _nC_k \text{ (bit),} \tag{1} \end{align}

where the value of the number nn is given in advance and the code-length can be non-integer valued.

Below the value of Eq.(1) for zz is denoted as L(z)L(z).

(2) Let the probability of y=1y = 1 for a datum with x1=1x_1 = 1 be θ\theta. Then calculate the least squares estimate of θ\theta from Figure 1. The least squares estimate of θ\theta is the value of θ\theta that minimizes t:x1=1(y(t)θ)2\sum_{t:x_1=1} (y(t) - \theta)^2 where y(t)y(t) denotes the value of yy for the tt-th datum and t:x1=1\sum_{t:x_1=1} denotes the sum taken over all the data such that x1=1x_1 = 1.

(3) Let yy be a binary string obtained by concatenating the values of yy for all the data in SS in Figure 1. Let y1(i)y^{(i)}_1 be a binary string obtained by concatenating the values of yy for all the data in SS such that xi=1x_i = 1 and let y0(i)y^{(i)}_0 be a binary string obtained by concatenating the values of yy for all the data in SS such that xi=0x_i = 0 (i=1,2,3,4i = 1, 2, 3, 4). For example, the indexes of data in SS such that x1=1x_1 = 1 are 11, 22, 33, 88, so the binary string obtained by concatenating the values of yy corresponding to them is y1(1)=1110y^{(1)}_1 = 1110. We define the measure of goodness of classifying data by partitioning SS based on whether xi=1x_i = 1 or xi=0x_i = 0 as follows:

Δ(iy)=defL(y1(i))+L(y0(i))(i=1,2,3,4).\begin{align} \Delta(i|y) \overset{\text{def}}{=} L(y^{(i)}_1) + L(y^{(i)}_0) \quad (i = 1, 2, 3, 4). \tag{2} \end{align}

We consider that the smaller the value of Eq.(2) is, the more the value of xix_i contributes to the classification of yy. Find ii that minimizes Δ(iy)\Delta(i|y). Hereinafter, when there are more than one xix_i’s that minimize the value of Eq.(2), one is chosen randomly from among them.

(4) Let the value of ii obtained in Question (3) be ii^*. SS is partitioned into two sets according to whether xi=1x_{i^*} = 1 or xi=0x_{i^*} = 0, then yy is also partitioned into two strings: y1(i)y^{(i^*)}_1 and y0(i)y^{(i^*)}_0. It can be represented using a tree structure as shown in Figure 2. We call it a partitioning tree. We call y1(i)y^{(i^*)}_1 and y0(i)y^{(i^*)}_0 partitioned strings. We further partition each of y1(i)y^{(i^*)}_1 and y0(i)y^{(i^*)}_0, by finding i (i)i \ (\neq i^*) minimizing Δ(iy1(i))\Delta(i|y^{(i^*)}_1) and minimizing Δ(iy0(i))\Delta(i|y^{(i^*)}_0), respectively. Let this partitioning of a leaf be repeated until the following stopping rule is fulfilled: The depth of a leaf (the number of partitionings from the root to the leaf) is two, or the partitioned string arriving at a leaf is all y=1y = 1 or all y=0y = 0. Find the partitioning tree that is finally obtained.

(5) For the resulting partitioning tree, for a partitioned string arriving at each leaf, we assign y=1y = 1 to the leaf if the number of occurrences of y=1y = 1 in this string is larger than that of y=0y = 0, and assign y=0y = 0 to the leaf if the number of occurrences of y=1y = 1 is smaller than that of y=0y = 0. When the number of occurrences of y=1y = 1 is the same as that of y=0y = 0, we assign randomly y=1y = 1 or y=0y = 0 to the leaf. This tree can be used for predicting the value of yy for any new datum. That is, when (x1,x2,x3,x4)(x_1, x_2, x_3, x_4) in the new datum is given
and arrives at a leaf, the tree predicts the value of its corresponding yy as the value of yy assigned to the leaf. Here, even if we change the stopping rule in Question (4) to construct a larger tree from a training data set SS so that the values of yy for data reaching at each leaf are all y=1y = 1 or all y=0y = 0, such a tree doesn’t necessarily predict the value of yy for a new datum with higher accuracy. Explain the reason.

(6) Consider a general case where for a positive integer d2d \geq 2, a set SS of multi-dimensional data in the form of (x1,,xd,y){0,1}d+1(x_1, \dots, x_d, y) \in \{0, 1\}^{d+1} and a partitioning tree T\mathcal{T} are given. Let M\mathcal{M} be a set of all subtrees which share the root of T\mathcal{T} and are obtained by pruning T\mathcal{T} starting
from its leaves. We define the following penalized criterion for evaluating the goodness of a subtree MMM \in \mathcal{M} for the given SS:

NL(M)CL+NI(M)CI+uL(yu),\begin{align} N_L(M) C_L + N_I(M) C_I + \sum_u L(y_u), \tag{3} \end{align}

where NL(M)N_L(M) is the total number of leaves in MM and NI(M)N_I(M) is the total number of inner nodes in MM. CLC_L and CIC_I are given positive constants. The sum in the third term in Eq.(3) is taken over all the leaves {u}\{u\} in MM and yuy_u is the binary string obtained by concatenating the values of yy for all the data which reach the leaf uu. The smaller the value of Eq.(3) is, the better MM is. Give an algorithm that finds MM minimizing the criterion Eq.(3) from M\mathcal{M} and SS, and runs as efficiently as possible in computation time.

Kai

(1) - By Myyura

The notation nCk_nC_k usually represents "n choose k".

For a fixed nn and kk, the total number of possible binary strings that satisfy these conditions is given by the binomial coefficient (nk)\binom{n}{k}, i.e. nCk_nC_k.

To uniquely identify any of these strings, we need a code of length:

log(nk)\log \binom{n}{k}

The length nn should be included as part of the encoded message, hence the total encoding length is:

log(n+1)+log(nk) (bit),(1)\log(n + 1) + \log \binom{n}{k} \text{ (bit),} \tag{1}

(2) - By tomfluff

Let us fine a θ\theta such that the least squares is minimized. Let us denote least squares as f(θ)f(\theta ).

f(θ)=t:x1=1(y(t)θ)2f(\theta )=\sum_{t:x_1=1}(y(t) - \theta )^2
f(θ)=(1θ)2+(1θ)2+(1θ)2+(0θ)2f(\theta )=(1 - \theta )^2+(1 - \theta )^2+(1 - \theta )^2+(0 - \theta )^2
f(θ)=3(1θ)2+(θ)2f(\theta )=3(1 - \theta )^2+(- \theta )^2
f(θ)=6+6θ+2θ=0f'(\theta )=-6+6\theta +2\theta = 0
8θ=6θ=34\Rightarrow 8\theta = 6 \Rightarrow \theta=\frac{3}{4}

Therefore, when θ=34\theta = \frac{3}{4} the least squares function is minimized.

(3) - By itsuitsuki

  • Δ(1y)=4+2log5\Delta(1|y)=4+2\log 5
  • Δ(2y)=4+log5+2log3\Delta(2|y)=4+\log 5+2\log 3
  • Δ(3y)=4+log5+2log3\Delta(3|y)=4+\log 5+2\log 3
  • Δ(4y)=2+2log5+2log3\Delta(4|y)=2+2\log 5+2\log 3 Hence i=1i=1 minimizes Δ(iy)\Delta(i|y).

(4) - By tomfluff

Note: Any mistakes here are derived from the issues with (1) mentioned before.

(5)

In machine learning there are the concepts of bias and variance. The bias indicates how much the generated prediction function fits the relationships between the data and the prediction. And variance indicates how much the prediction function fits "new" data (testing data). When the prediction function fits the training data too well it is called "over fitting" and over fitting leads to low bias but high variance. In the mentioned case, extending the tree would result in over fitting the prediction function to the data set. Meaning that on new data the variance will be large and it will not improve the overall prediction.

(6) - by Gemini

The algorithm will work as Cost-Complexity Pruning. Tomfluff (the previous solution provider in this problem) misrecognizes this as a Minimum Error Pruning technique which is different. Similar pruning algorithms include PEP (Pessimistic Error Pruning), etc.

The algorithm is dynamic programming:

  1. Post-order traverse every node;
  2. For each internal node uu, we can choose to
    1. Prune the node into a leaf with contribution to criterion Costprune(u)=CL+L(all data under u)\text{Cost}_{\text{prune}}(u) = C_L + L(\text{all data under }u)
    2. Keep the subtree rooted at uu with contribution $\text{Cost}{\text{keep}}(u) = C_I + \sum{v\in \text{children}(u)} \text{Cost}_{\min}(u)
  3. Choose a minimum-contribution action with Costmin(u)=min(Costprune(u),Costkeep(u))\text{Cost}_{\min}(u) = \min(\text{Cost}_{\text{prune}}(u), \text{Cost}_{\text{keep}}(u)). When pruning, mark this subtree rooted at uu as a leaf.

Since in this DP, all nodes are traversed and computed for at once, the time complexity is O(T)O(|\mathcal T|).