Skip to content

Commit 522d491

Browse files
committed
up
1 parent 9a49622 commit 522d491

9 files changed

+2357
-273
lines changed

homework/.DS_Store

0 Bytes
Binary file not shown.

homework/.ipynb_checkpoints/Day6_homework_bigdata_falsenews_v2-checkpoint.ipynb

Lines changed: 56 additions & 16 deletions
Large diffs are not rendered by default.

homework/.ipynb_checkpoints/Day7_homework_machinelearning_v2-checkpoint.ipynb

Lines changed: 1012 additions & 0 deletions
Large diffs are not rendered by default.

homework/Day7_homework_machinelearning_v2.ipynb

Lines changed: 1012 additions & 0 deletions
Large diffs are not rendered by default.
6.65 KB
Binary file not shown.

notebook/.ipynb_checkpoints/06.05-Naive-Bayes-checkpoint.ipynb

Lines changed: 55 additions & 48 deletions
Large diffs are not rendered by default.

notebook/06.05-Naive-Bayes.ipynb

Lines changed: 53 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
"We are intrested in finding the probability of a label given some observed features, $P(L~|~{\\rm features})$.\n",
7373
"\n",
7474
"Bayes's theorem:\n",
75-
"$$P(L~|~{\\rm features}) = \\frac{P({\\rm features}~|~L)P(L)}{P({\\rm features})}$$\n",
75+
"$$P(L~|~{\\rm features}) = \\frac{P({\\rm features}~|~L)P(L)}{P({\\rm features})}=\\frac{P({\\rm features},~L)}{P({\\rm features})}$$\n",
7676
"\n",
7777
"$$\\mbox{posterior} = \\frac{\\mbox{likelihood}\\times \\mbox{prior}}{\\mbox{evidence}} \\$$\n",
7878
"\n"
@@ -149,14 +149,15 @@
149149
}
150150
},
151151
"source": [
152-
"- **Discrimitave models** (判别式模型): \n",
153-
" - 给定$x$,直接建模$P(L|x)$来预测$L$\n",
154-
" - Decision Tree, SVM\n",
152+
"估计类条件概率(Likelihood)的常用策略:先假定其具有某种确定的概率分布形式,再基于训练样本对概率分布参数估计。\n",
153+
"\n",
155154
"- **Generative models** (生成式模型): \n",
156155
" - 先对联合概率分布$P(L, x)$建模, 再由此获得$P(L|x)$\n",
157156
" - Naive Bayes\n",
158-
" \n",
159-
"估计类条件概率(Likelihood)的常用策略:先假定其具有某种确定的概率分布形式,再基于训练样本对概率分布参数估计。"
157+
"- **Discrimitave models** (判别式模型): \n",
158+
" - 给定$x$,直接建模$P(L|x)$来预测$L$\n",
159+
" - Decision Tree, SVM\n",
160+
" \n"
160161
]
161162
},
162163
{
@@ -448,11 +449,11 @@
448449
},
449450
{
450451
"cell_type": "code",
451-
"execution_count": 1,
452+
"execution_count": 3,
452453
"metadata": {
453454
"ExecuteTime": {
454-
"end_time": "2020-06-07T08:35:58.024754Z",
455-
"start_time": "2020-06-07T08:35:55.455356Z"
455+
"end_time": "2020-08-12T02:04:50.523048Z",
456+
"start_time": "2020-08-12T02:04:50.518097Z"
456457
},
457458
"slideshow": {
458459
"slide_type": "slide"
@@ -463,16 +464,17 @@
463464
"%matplotlib inline\n",
464465
"import numpy as np\n",
465466
"import matplotlib.pyplot as plt\n",
466-
"import seaborn as sns; sns.set()"
467+
"import seaborn as sns\n",
468+
"sns.set()"
467469
]
468470
},
469471
{
470472
"cell_type": "code",
471-
"execution_count": 2,
473+
"execution_count": 5,
472474
"metadata": {
473475
"ExecuteTime": {
474-
"end_time": "2020-06-07T08:36:02.397317Z",
475-
"start_time": "2020-06-07T08:36:01.631419Z"
476+
"end_time": "2020-08-12T02:08:39.040229Z",
477+
"start_time": "2020-08-12T02:08:38.730153Z"
476478
},
477479
"slideshow": {
478480
"slide_type": "subslide"
@@ -545,11 +547,11 @@
545547
},
546548
{
547549
"cell_type": "code",
548-
"execution_count": 3,
550+
"execution_count": 6,
549551
"metadata": {
550552
"ExecuteTime": {
551-
"end_time": "2020-06-07T08:36:48.611732Z",
552-
"start_time": "2020-06-07T08:36:48.599037Z"
553+
"end_time": "2020-08-12T02:08:43.850456Z",
554+
"start_time": "2020-08-12T02:08:43.845443Z"
553555
},
554556
"slideshow": {
555557
"slide_type": "subslide"
@@ -575,11 +577,11 @@
575577
},
576578
{
577579
"cell_type": "code",
578-
"execution_count": 4,
580+
"execution_count": 7,
579581
"metadata": {
580582
"ExecuteTime": {
581-
"end_time": "2020-06-07T08:36:57.076423Z",
582-
"start_time": "2020-06-07T08:36:57.058964Z"
583+
"end_time": "2020-08-12T02:09:11.457280Z",
584+
"start_time": "2020-08-12T02:09:11.452597Z"
583585
},
584586
"slideshow": {
585587
"slide_type": "fragment"
@@ -738,17 +740,25 @@
738740
},
739741
{
740742
"cell_type": "code",
741-
"execution_count": 6,
743+
"execution_count": 8,
742744
"metadata": {
743745
"ExecuteTime": {
744-
"end_time": "2020-06-07T08:40:00.834720Z",
745-
"start_time": "2020-06-07T08:40:00.308020Z"
746+
"end_time": "2020-08-12T02:12:08.328363Z",
747+
"start_time": "2020-08-12T02:12:08.048029Z"
746748
},
747749
"slideshow": {
748750
"slide_type": "subslide"
749751
}
750752
},
751753
"outputs": [
754+
{
755+
"name": "stderr",
756+
"output_type": "stream",
757+
"text": [
758+
"/opt/anaconda3/lib/python3.7/site-packages/sklearn/utils/deprecation.py:144: FutureWarning: The sklearn.datasets.base module is deprecated in version 0.22 and will be removed in version 0.24. The corresponding classes / functions should instead be imported from sklearn.datasets. Anything that cannot be imported from sklearn.datasets is now part of the private API.\n",
759+
" warnings.warn(message, FutureWarning)\n"
760+
]
761+
},
752762
{
753763
"data": {
754764
"text/plain": [
@@ -774,7 +784,7 @@
774784
" 'talk.religion.misc']"
775785
]
776786
},
777-
"execution_count": 6,
787+
"execution_count": 8,
778788
"metadata": {},
779789
"output_type": "execute_result"
780790
}
@@ -799,11 +809,11 @@
799809
},
800810
{
801811
"cell_type": "code",
802-
"execution_count": 7,
812+
"execution_count": 9,
803813
"metadata": {
804814
"ExecuteTime": {
805-
"end_time": "2020-06-07T08:41:35.566570Z",
806-
"start_time": "2020-06-07T08:41:34.611060Z"
815+
"end_time": "2020-08-12T02:13:31.352385Z",
816+
"start_time": "2020-08-12T02:13:30.846495Z"
807817
},
808818
"slideshow": {
809819
"slide_type": "fragment"
@@ -885,11 +895,11 @@
885895
},
886896
{
887897
"cell_type": "code",
888-
"execution_count": 8,
898+
"execution_count": 10,
889899
"metadata": {
890900
"ExecuteTime": {
891-
"end_time": "2020-06-07T08:43:21.096094Z",
892-
"start_time": "2020-06-07T08:43:21.084334Z"
901+
"end_time": "2020-08-12T02:16:55.162506Z",
902+
"start_time": "2020-08-12T02:16:55.154107Z"
893903
},
894904
"slideshow": {
895905
"slide_type": "subslide"
@@ -917,11 +927,11 @@
917927
},
918928
{
919929
"cell_type": "code",
920-
"execution_count": 9,
930+
"execution_count": 11,
921931
"metadata": {
922932
"ExecuteTime": {
923-
"end_time": "2020-06-07T08:43:34.213419Z",
924-
"start_time": "2020-06-07T08:43:32.353064Z"
933+
"end_time": "2020-08-12T02:17:10.509105Z",
934+
"start_time": "2020-08-12T02:17:09.528286Z"
925935
},
926936
"slideshow": {
927937
"slide_type": "fragment"
@@ -1004,11 +1014,11 @@
10041014
},
10051015
{
10061016
"cell_type": "code",
1007-
"execution_count": 10,
1017+
"execution_count": 12,
10081018
"metadata": {
10091019
"ExecuteTime": {
1010-
"end_time": "2020-06-07T08:45:03.307208Z",
1011-
"start_time": "2020-06-07T08:45:03.300694Z"
1020+
"end_time": "2020-08-12T02:19:27.699454Z",
1021+
"start_time": "2020-08-12T02:19:27.696304Z"
10121022
},
10131023
"slideshow": {
10141024
"slide_type": "subslide"
@@ -1035,11 +1045,11 @@
10351045
},
10361046
{
10371047
"cell_type": "code",
1038-
"execution_count": 11,
1048+
"execution_count": 13,
10391049
"metadata": {
10401050
"ExecuteTime": {
1041-
"end_time": "2020-06-07T08:45:27.750035Z",
1042-
"start_time": "2020-06-07T08:45:27.737839Z"
1051+
"end_time": "2020-08-12T02:19:54.328917Z",
1052+
"start_time": "2020-08-12T02:19:54.323217Z"
10431053
},
10441054
"slideshow": {
10451055
"slide_type": "fragment"
@@ -1052,7 +1062,7 @@
10521062
"'sci.space'"
10531063
]
10541064
},
1055-
"execution_count": 11,
1065+
"execution_count": 13,
10561066
"metadata": {},
10571067
"output_type": "execute_result"
10581068
}
@@ -1063,11 +1073,11 @@
10631073
},
10641074
{
10651075
"cell_type": "code",
1066-
"execution_count": 12,
1076+
"execution_count": 14,
10671077
"metadata": {
10681078
"ExecuteTime": {
1069-
"end_time": "2020-06-07T08:45:52.957854Z",
1070-
"start_time": "2020-06-07T08:45:52.933849Z"
1079+
"end_time": "2020-08-12T02:20:47.360059Z",
1080+
"start_time": "2020-08-12T02:20:47.354526Z"
10711081
},
10721082
"slideshow": {
10731083
"slide_type": "fragment"
@@ -1080,7 +1090,7 @@
10801090
"'soc.religion.christian'"
10811091
]
10821092
},
1083-
"execution_count": 12,
1093+
"execution_count": 14,
10841094
"metadata": {},
10851095
"output_type": "execute_result"
10861096
}

0 commit comments

Comments
 (0)