Bootstraping

Bootstrap简介

Bootstrap方法是非常有用的一种统计学上的估计方法,是斯坦福统计系的教授Bradley Efron(我曾有幸去教授办公室约谈了一次)在总结、归纳前人研究成果的基础上提出一种新的非参数统计方法。Bootstrap是一类非参数Monte Carlo方法,其实质是对观测信息进行再抽样,进而对总体的分布特性进行统计推断。

因为该方法充分利用了给定的观测信息,不需要模型其他的假设和增加新的观测,并且具有稳健性和效率高的特点。1980年代以来,随着计算机技术被引入到统计实践中来,此方法越来越受欢迎,在机器学习领域应用也很广泛。

首先,Bootstrap通过重抽样,可以避免了Cross-Validation造成的样本减少问题,其次,Bootstrap也可以用于创造数据的随机性。比如,我们所熟知的随机森林算法第一步就是从原始训练数据集中,应用bootstrap方法有放回地随机抽取k个新的自助样本集,并由此构建k棵分类回归树。

具体讲解

Bootstraping_第1张图片
image.png

Bootstrap步骤:

Bootstraping_第2张图片
image.png

Bootstraping_第3张图片
image

Bootstraping_第4张图片
image.png

Bootstraping_第5张图片
image.png

python 实现

%matplotlib inline
import scipy as sp
import matplotlib.pyplot as plt
from scipy import stats
import scikits.bootstrap as bootstrap
# Generate a non-normally distributed datasample
data = stats.poisson.rvs(2, size=1000)

# Show the data
plt.plot(data, '.')
plt.title('Non-normally distributed dataset: Press any key to continue')
Bootstraping_第6张图片
image.png
# Calculate the bootstrap
CIs = bootstrap.ci(data=data, statfunction=sp.mean)

# Print the data: the "*" turns the array CIs into a list
print('The conficence intervals for the mean are: {0} - {1}'.format(*CIs))

The conficence intervals for the mean are: 1.816 - 1.99

例题

Bootstraping_第7张图片
image.png

Bootstraping_第8张图片
image.png

Bootstraping_第9张图片
image.png

你可能感兴趣的:(Bootstraping)