Skip to content

Commit b2f0a47

Browse files
committed
docs: fix plotly errors; move anova to big_data_analytics
1 parent 7dbc3bd commit b2f0a47

File tree

125 files changed

+9391
-335806
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

125 files changed

+9391
-335806
lines changed

docs/.nojekyll

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/coding_projects/P1_ANOVA/anova.html

Lines changed: 247 additions & 242 deletions
Large diffs are not rendered by default.
651 KB
Binary file not shown.

docs/coding_projects/P1_ANOVA/anova.html.md

Lines changed: 67 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -35,22 +35,22 @@ toc: true
3535

3636
我们这样做的好处是,避免单独管理一堆 .py 文件,防止代码冗余和同步混乱,py文件和pdf文件都是从.ipynb文件导出的,可以保证实验文档和代码的一致性。
3737

38-
!!! important
38+
::: {.callout-important}
39+
可以通过以下命令安装我们实验的代码:
3940

40-
可以通过以下命令安装我们实验的代码:
41-
42-
```shell
43-
pip install git+https://github.com/Open-Book-Studio/THU-Coursework-Machine-Learning-for-Big-Data.git
44-
pip install matplotlib seaborn openpyxl scipy statsmodels
45-
```
46-
我们的代码导出为了python模块形式,通过以下命令导入:
47-
```python
48-
from thu_big_data_ml.big_data_analytics.anova import *
49-
```
50-
51-
!!! important
41+
```shell
42+
pip install git+https://github.com/Open-Book-Studio/THU-Coursework-Machine-Learning-for-Big-Data.git
43+
pip install matplotlib seaborn openpyxl scipy statsmodels
44+
```
45+
我们的代码导出为了python模块形式,通过以下命令导入:
46+
```python
47+
from thu_big_data_ml.big_data_analytics.anova import *
48+
```
49+
:::
5250

53-
本文档具有一定的交互性,建议使用浏览器打开html文件,这样比pdf文件阅读体验更佳。
51+
::: {.callout-important}
52+
本文档具有一定的交互性,建议使用浏览器打开html文件,这样比pdf文件阅读体验更佳。
53+
:::
5454

5555
## 1. Recall and write down the assumptions which one-way ANOVA are based on.
5656

@@ -432,40 +432,55 @@ plt.show()
432432
Lilliefors and Anderson-Darling tests](https://www.nrc.gov/docs/ML1714/ML17143A100.pdf)
433433
里面对各个检验都有介绍,结合其他网络资料,我整理了以下的思维导图:
434434

435-
``` mermaid
436-
graph LR
437-
A[正态性检验] --> B[Shapiro-Wilk 夏皮罗-威尔克 检验]
438-
A --> C[Kolmogorov-Smirnov检验]
439-
A --> D[Anderson-Darling 安德森-达令检验]
440-
A --> E[D'Agostino-Pearson检验]
441-
A --> Z[Lilliefors检验]
442435

443-
B --> F[零假设: 数据集来自于正态分布]
444-
B --> G[使用条件: 小样本, 具体来说n<50]
445-
B --> H[优点: 灵敏度高, 被认为是小样本情况下最强大的检验, 计算效率高]
446-
B --> I[缺点: 不适用于大样本, 过度敏感, 可能数据稍微偏离就误判不符合正态分布 ]
436+
::::::{.cell layout-align="default"}
447437

448-
C --> J[零假设: 样本来自的总体与指定的理论分布无显著差异]
449-
C --> K[使用条件: 适用于连续分布, 大样本]
450-
C --> L[优点: 无需分布假设, 可以两列样本直接比较, 不需要指定分布参数]
451-
C --> M[缺点: 小样本上不够强大]
438+
:::::{.cell-output-display}
452439

453-
D --> N[零假设: 样本来自的总体与指定的理论分布无显著差异]
454-
D --> O[使用条件: 适用于各种样本大小, 特别是当需要重视分布尾部差异时]
455-
D --> P[优点: 更重视分布尾部, 某些情况下比KS强大]
456-
D --> Q[缺点: 计算复杂, 每一个分布需要计算特定的临界值]
440+
::::{}
441+
`<figure class=''>`{=html}
457442

458-
E --> R[零假设: 数据集来自于正态分布]
459-
E --> S[使用条件: 大多数情况都可以]
460-
E --> T[优点: 基于偏度和峰度系数]
461-
E --> U[缺点: 结果容易受到异常值的影响]
443+
:::{}
462444

463-
Z --> V[零假设: 数据集来自于正态分布]
464-
Z --> W[使用条件: 适用于小样本数据]
465-
Z --> X[优点: 虽然是检验正态性, 但是不用假设是来自于哪一个正态分布, 就是均值方差不用指定, 因为是KS检验的改进版]
466-
Z --> Y[缺点: 对于非独立同分布的数据不适用]
445+
<pre class="mermaid mermaid-js">graph LR
446+
A[正态性检验] --&gt; B[Shapiro-Wilk 夏皮罗-威尔克 检验]
447+
A --&gt; C[Kolmogorov-Smirnov检验]
448+
A --&gt; D[Anderson-Darling 安德森-达令检验]
449+
A --&gt; E[D&#39;Agostino-Pearson检验]
450+
A --&gt; Z[Lilliefors检验]
451+
452+
B --&gt; F[零假设: 数据集来自于正态分布]
453+
B --&gt; G[使用条件: 小样本, 具体来说n&lt;50]
454+
B --&gt; H[优点: 灵敏度高, 被认为是小样本情况下最强大的检验, 计算效率高]
455+
B --&gt; I[缺点: 不适用于大样本, 过度敏感, 可能数据稍微偏离就误判不符合正态分布 ]
456+
457+
C --&gt; J[零假设: 样本来自的总体与指定的理论分布无显著差异]
458+
C --&gt; K[使用条件: 适用于连续分布, 大样本]
459+
C --&gt; L[优点: 无需分布假设, 可以两列样本直接比较, 不需要指定分布参数]
460+
C --&gt; M[缺点: 小样本上不够强大]
461+
462+
D --&gt; N[零假设: 样本来自的总体与指定的理论分布无显著差异]
463+
D --&gt; O[使用条件: 适用于各种样本大小, 特别是当需要重视分布尾部差异时]
464+
D --&gt; P[优点: 更重视分布尾部, 某些情况下比KS强大]
465+
D --&gt; Q[缺点: 计算复杂, 每一个分布需要计算特定的临界值]
466+
467+
E --&gt; R[零假设: 数据集来自于正态分布]
468+
E --&gt; S[使用条件: 大多数情况都可以]
469+
E --&gt; T[优点: 基于偏度和峰度系数]
470+
E --&gt; U[缺点: 结果容易受到异常值的影响]
471+
472+
Z --&gt; V[零假设: 数据集来自于正态分布]
473+
Z --&gt; W[使用条件: 适用于小样本数据]
474+
Z --&gt; X[优点: 虽然是检验正态性, 但是不用假设是来自于哪一个正态分布, 就是均值方差不用指定, 因为是KS检验的改进版]
475+
Z --&gt; Y[缺点: 对于非独立同分布的数据不适用]
476+
477+
</pre>
478+
:::
479+
`</figure>`{=html}
480+
::::
481+
:::::
482+
::::::
467483

468-
```
469484

470485
根据 https://www.lcgdbzz.org/custom/news/id/7951, 样本量大被认为是大于2000,
471486
而根据https://blog.csdn.net/book_dw5189/article/details/133475648, 样本量<50或者 <200就认为小。
@@ -983,7 +998,7 @@ anova_table
983998

984999
[source](https://github.com/Open-Book-Studio/THU-Coursework-Machine-Learning-for-Big-Data/blob/main/thu_big_data_ml/big_data_analytics/anova.py#L12){target="_blank" style="float:right; font-size:smaller"}
9851000

986-
### anova_oneway
1001+
anova_oneway
9871002

9881003
> anova_oneway (*groups:numpy.ndarray)
9891004
@@ -1404,7 +1419,7 @@ chosen_cols
14041419

14051420
[source](https://github.com/Open-Book-Studio/THU-Coursework-Machine-Learning-for-Big-Data/blob/main/thu_big_data_ml/big_data_analytics/anova.py#L90){target="_blank" style="float:right; font-size:smaller"}
14061421

1407-
### draw_hist
1422+
draw_hist
14081423

14091424
> draw_hist (df, chosen_cols, hue_col='群类别', transform=None,
14101425
> column_name_transform=None)
@@ -1437,7 +1452,7 @@ draw_hist(df, chosen_cols, hue_col='群类别')
14371452

14381453
[source](https://github.com/Open-Book-Studio/THU-Coursework-Machine-Learning-for-Big-Data/blob/main/thu_big_data_ml/big_data_analytics/anova.py#L115){target="_blank" style="float:right; font-size:smaller"}
14391454

1440-
### test_normality_group
1455+
test_normality_group
14411456

14421457
> test_normality_group (df, interesting_col, hue_col='群类别', transform=None)
14431458
@@ -1528,7 +1543,7 @@ D'Agostino-Pearson Not Normal Not Normal Normal Not Normal Not Normal
15281543

15291544
[source](https://github.com/Open-Book-Studio/THU-Coursework-Machine-Learning-for-Big-Data/blob/main/thu_big_data_ml/big_data_analytics/anova.py#L139){target="_blank" style="float:right; font-size:smaller"}
15301545

1531-
### homogeneity_of_variance
1546+
homogeneity_of_variance
15321547

15331548
> homogeneity_of_variance (df, interesting_col, hue_col='群类别',
15341549
> transform=None)
@@ -1628,7 +1643,7 @@ Reject the null hypothesis of equal variances!
16281643

16291644
[source](https://github.com/Open-Book-Studio/THU-Coursework-Machine-Learning-for-Big-Data/blob/main/thu_big_data_ml/big_data_analytics/anova.py#L169){target="_blank" style="float:right; font-size:smaller"}
16301645

1631-
### auto_anova_for_df
1646+
auto_anova_for_df
16321647

16331648
> auto_anova_for_df (df, interesting_col, hue_col='群类别', transform=None)
16341649
@@ -1901,7 +1916,7 @@ res_dfs[2]
19011916

19021917
[source](https://github.com/Open-Book-Studio/THU-Coursework-Machine-Learning-for-Big-Data/blob/main/thu_big_data_ml/big_data_analytics/anova.py#L182){target="_blank" style="float:right; font-size:smaller"}
19031918

1904-
### draw_box
1919+
draw_box
19051920

19061921
> draw_box (df, chosen_cols, hue_col='群类别', transform=None,
19071922
> column_name_transform=None)
@@ -1931,9 +1946,9 @@ draw_box(df, chosen_cols)
19311946

19321947
---
19331948

1934-
[source](https://github.com/Open-Book-Studio/THU-Coursework-Machine-Learning-for-Big-Data/blob/main/thu_big_data_ml/big_data_analytics/anova.py#L194){target="_blank" style="float:right; font-size:smaller"}
1949+
[source](https://github.com/Open-Book-Studio/THU-Coursework-Machine-Learning-for-Big-Data/blob/main/thu_big_data_ml/big_data_analytics/anova.py#L196){target="_blank" style="float:right; font-size:smaller"}
19351950

1936-
### auto_friedman_for_df
1951+
auto_friedman_for_df
19371952

19381953
> auto_friedman_for_df (df, interesting_col, hue_col='群类别', transform=None)
19391954
@@ -1968,9 +1983,9 @@ Error: Unequal N in friedmanchisquare. Aborting.
19681983

19691984
---
19701985

1971-
[source](https://github.com/Open-Book-Studio/THU-Coursework-Machine-Learning-for-Big-Data/blob/main/thu_big_data_ml/big_data_analytics/anova.py#L210){target="_blank" style="float:right; font-size:smaller"}
1986+
[source](https://github.com/Open-Book-Studio/THU-Coursework-Machine-Learning-for-Big-Data/blob/main/thu_big_data_ml/big_data_analytics/anova.py#L214){target="_blank" style="float:right; font-size:smaller"}
19721987

1973-
### auto_kruskal_for_df
1988+
auto_kruskal_for_df
19741989

19751990
> auto_kruskal_for_df (df, interesting_col, hue_col='群类别', transform=None)
19761991

0 commit comments

Comments
 (0)