# 極簡筆記 Meta-Learning for semi-supervised few-shot classification

#### soft K-Means

p~c=∑ih(xi)zi,c ∑jh(x~j)z~j,c∑izi,c ∑jz~j,cmj,c,where z~j,c=exp(−||h(x~j−pc||22)∑c′exp(−||h(x~j)−pc′||22)” role=”presentation”>p˜c=∑ih(xi)zi,c ∑jh(x˜j)z˜j,c∑izi,c ∑jz˜j,cmj,c,where z˜j,c=exp(−||h(x˜j−pc||22)∑c′exp(−||h(x˜j)−pc′||22)p~c=∑ih(xi)zi,c ∑jh(x~j)z~j,c∑izi,c ∑jz~j,cmj,c,where z~j,c=exp(−||h(x~j−pc||22)∑c′exp(−||h(x~j)−pc′||22)

\widetilde{p}_c=\frac{\sum_i h(x_i)z_{i,c} \sum_j h(\widetilde{x}_j)\widetilde{z}_{j,c}}{\sum_i z_{i,c} \sum_j\widetilde{z}_{j,c}m_{j,c}},\text{where }\widetilde{z}_{j,c}=\frac{exp(-||h(\widetilde{x}_j-p_c||^2_2)}{\sum_{c’}exp(-||h(\widetilde{x}_j)-p_{c’}||^2_2)}

#### soft K-Means with cluster

pc={∑ih(xi)zi,c∑izi,cfor c=1…N0for c=N 1″ role=”presentation”>pc={∑ih(xi)zi,c∑izi,c0for c=1…Nfor c=N 1pc={∑ih(xi)zi,c∑izi,cfor c=1…N0for c=N 1

p_c=\begin{cases}\frac{\sum_i h(x_i)z_{i,c}}{\sum_i z_{i,c}} & \text{for }c=1…N\\0 & \text{for }c=N 1\end{cases}

z~j,c=exp(−1rc2||x~j−pc||22−A(rc))∑c′exp(−1rc′2||x~j−pc′||22−A(rc′)),where A(r)=12log(2π) log(r)” role=”presentation”>z˜j,c=exp(−1r2c||x˜j−pc||22−A(rc))∑c′exp(−1r2c′||x˜j−pc′||22−A(rc′)),where A(r)=12log(2π) log(r)z~j,c=exp(−1rc2||x~j−pc||22−A(rc))∑c′exp(−1rc′2||x~j−pc′||22−A(rc′)),where A(r)=12log(2π) log(r)

\widetilde{z}_{j,c}=\frac{exp(-\frac{1}{r_c^2}||\widetilde{x}_j-p_c||^2_2-A(r_c))}{\sum_{c’}exp(-\frac{1}{r_{c’}^2}||\widetilde{x}_j-p_{c’}||^2_2-A(r_{c’}))}, \text{where }A(r)=\frac{1}{2}log(2\pi) log(r)

#### masked soft K-Means

d~j,c=dj,c1M∑jdj,c,where dj,c=||h(x~j)−pc||22″ role=”presentation”>d˜j,c=dj,c1M∑jdj,c,where dj,c=||h(x˜j)−pc||22d~j,c=dj,c1M∑jdj,c,where dj,c=||h(x~j)−pc||22

\widetilde{d}_{j,c}=\frac{d_{j,c}}{\frac{1}{M}\sum_j d_{j,c}}, \text{where }d_{j,c}=||h(\widetilde{x}_j)-p_c||^2_2

[βc,γc]=MLP([minj(d~j,c),maxj(d~j,c),varj(d~j,c),skewj(d~j,c),kurtj(d~j,c)])” role=”presentation”>[βc,γc]=MLP([minj(d˜j,c),maxj(d˜j,c),varj(d˜j,c),skewj(d˜j,c),kurtj(d˜j,c)])[βc,γc]=MLP([minj(d~j,c),maxj(d~j,c),varj(d~j,c),skewj(d~j,c),kurtj(d~j,c)])

[\beta_c,\gamma_c]=MLP\left(\left[min_j(\widetilde{d}_{j,c}),max_j(\widetilde{d}_{j,c}), var_j(\widetilde{d}_{j,c}),skew_j(\widetilde{d}_{j,c}),kurt_j(\widetilde{d}_{j,c})\right]\right)

p~c=∑ih(xi)zi,c ∑jh(x~j)z~j,cmj,c∑izi,c ∑jz~j,cmj,c,where mj,c=sigmoid(−γc(d~j,c−βc))” role=”presentation”>p˜c=∑ih(xi)zi,c ∑jh(x˜j)z˜j,cmj,c∑izi,c ∑jz˜j,cmj,c,where mj,c=sigmoid(−γc(d˜j,c−βc))p~c=∑ih(xi)zi,c ∑jh(x~j)z~j,cmj,c∑izi,c ∑jz~j,cmj,c,where mj,c=sigmoid(−γc(d~j,c−βc))

\widetilde{p}_c=\frac{\sum_i h(x_i)z_{i,c} \sum_j h(\widetilde{x}_j)\widetilde{z}_{j,c}m_{j,c}}{\sum_i z_{i,c} \sum_j\widetilde{z}_{j,c}m_{j,c}},\text{where }m_{j,c}=sigmoid(-\gamma_c(\widetilde{d}_{j,c}-\beta_c))