## # Sub Quadratic Loss Function

$$L_k(x)=\frac{x^2}{1+|x|^{2-k}}, \quad 0\leq k\leq 2$$$$\lim_{x\to0} L_k(x)=x^2,\quad \lim_{x\to\infty} L_k(x)=x^k$$

At $|x|^{2-k}\ll 1$, it is $x^2$. That is $|x|<e^{-C/(2-k)}$, where $C\sim3$. In linear regression, we often use loss function $L_2(x)=x^2/2$ which leads to linear fitting.

## # Gain Function

For $k=0$, we can define Gain function $$G(x)=1-L_0(x)=\frac{1}{1+x^2}$$

Consider scaling factor $l$, $$G_l(x)=\frac{1}{1+(x/l)^2}$$

For some parameter $\lambda$, calculate the gain $\Gamma(\lambda)=\sum_i G_l(x_i)$. The optimized gain means best estimation.

## 分钱问题

$m_i$为第$i$个人的钱数，

• 求第$i$个人的钱数$m_i$取值的概率分布
• 求对某固定钱数$m$，抽到这个钱数的人的数量$n_m=\sum (m_i = m)$

## # 数据分析

In [2]:
import pandas as pd
from functools import reduce

In [3]:
data=[pd.read_table('%d.txt'%i) for i in range(2, 5)]


## # 贝叶斯分析

\begin{align} p(x)&=\int p(x|y)\rho(y)dy\\ &=\frac{1}{2}\int [\delta(x-2y)+\delta(x-y)]\rho(y)dy\\ &=\frac{\rho(x)}{2}+\frac{\rho(x/2)}{4} \end{align}