1 Star 0 Fork 47

花大虫张/Book5_Essentials-of-Probability-and-Statistics

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Bk5_Ch23_04.py 944 Bytes
一键复制 编辑 原始数据 按行查看 历史
Visualize-ML 提交于 2022-12-02 15:58 . Add files via upload
###############
# Authored by Weisheng Jiang
# Book 6 | From Basic Arithmetic to Machine Learning
# Published and copyrighted by Tsinghua University Press
# Beijing, China, 2022
###############
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats.distributions import chi2
intervals = np.linspace(0.9, 0.99, 11);
np.sqrt(chi2.ppf((0.9,0.95,0.99), df=1))
dist_chi2_sqrt = np.sqrt(chi2.ppf(intervals, df=2));
num_sigma = np.linspace(1,3,3)
prob = chi2.cdf(num_sigma**2, df=2)
x = np.linspace(0,4,100) # mahal d
fig, ax = plt.subplots(figsize=(8, 8))
for df in [1,2,3,4,5,6]:
prob_x_df_D = chi2.cdf(x**2, df=df)
plt.plot(x,prob_x_df_D, label = 'df = ' + str(df))
plt.grid(color = (0.8,0.8,0.8))
plt.legend()
plt.yticks(np.linspace(0,1,21))
plt.xticks(np.linspace(0,4,21))
plt.xlim(0,4)
plt.ylim(0,1)
plt.xlabel('Mahal d ($\sigma$)')
plt.ylabel('$\u03B1$')
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/hua-da-chong-zhang/Book5_Essentials-of-Probability-and-Statistics.git
git@gitee.com:hua-da-chong-zhang/Book5_Essentials-of-Probability-and-Statistics.git
hua-da-chong-zhang
Book5_Essentials-of-Probability-and-Statistics
Book5_Essentials-of-Probability-and-Statistics
main

搜索帮助