Skip to content

Commit 191196c

Browse files
committed
Created using Colaboratory
1 parent 85c77d1 commit 191196c

1 file changed

Lines changed: 78 additions & 35 deletions

File tree

Lesson15_Python_For_Data_Science_CaseStudies.ipynb

Lines changed: 78 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"nbformat_minor": 0,
44
"metadata": {
55
"colab": {
6-
"name": "Lesson16-Python For Data Science-CaseStudies.ipynb",
6+
"name": "Lesson15-Python For Data Science-CaseStudies.ipynb",
77
"version": "0.3.2",
88
"provenance": [],
99
"collapsed_sections": [
@@ -35,7 +35,7 @@
3535
"colab_type": "text"
3636
},
3737
"source": [
38-
"<a href=\"https://colab.research.google.com/github/paiml/python_for_datascience/blob/master/Lesson16_Python_For_Data_Science_CaseStudies.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
38+
"<a href=\"https://colab.research.google.com/github/paiml/python_for_datascience/blob/master/Lesson15_Python_For_Data_Science_CaseStudies.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
3939
]
4040
},
4141
{
@@ -48,6 +48,49 @@
4848
"# Lesson 16: Case Studies"
4949
]
5050
},
51+
{
52+
"metadata": {
53+
"id": "c_Id55m6Jsbu",
54+
"colab_type": "text"
55+
},
56+
"cell_type": "markdown",
57+
"source": [
58+
"## Pragmatic AI Labs\n",
59+
"\n"
60+
]
61+
},
62+
{
63+
"metadata": {
64+
"id": "e5p96AqpSDZa",
65+
"colab_type": "text"
66+
},
67+
"cell_type": "markdown",
68+
"source": [
69+
"![alt text](https://paiml.com/images/logo_with_slogan_white_background.png)\n",
70+
"\n",
71+
"This notebook was produced by [Pragmatic AI Labs](https://paiml.com/). You can continue learning about these topics by:\n",
72+
"\n",
73+
"* Buying a copy of [Pragmatic AI: An Introduction to Cloud-Based Machine Learning](http://www.informit.com/store/pragmatic-ai-an-introduction-to-cloud-based-machine-9780134863917)\n",
74+
"* Reading an online copy of [Pragmatic AI:Pragmatic AI: An Introduction to Cloud-Based Machine Learning](https://www.safaribooksonline.com/library/view/pragmatic-ai-an/9780134863924/)\n",
75+
"* Watching video [Essential Machine Learning and AI with Python and Jupyter Notebook-Video-SafariOnline](https://www.safaribooksonline.com/videos/essential-machine-learning/9780135261118) on Safari Books Online.\n",
76+
"* Watching video [AWS Certified Machine Learning-Speciality](https://learning.oreilly.com/videos/aws-certified-machine/9780135556597)\n",
77+
"* Purchasing video [Essential Machine Learning and AI with Python and Jupyter Notebook- Purchase Video](http://www.informit.com/store/essential-machine-learning-and-ai-with-python-and-jupyter-9780135261095)\n",
78+
"* Viewing more content at [noahgift.com](https://noahgift.com/)\n"
79+
]
80+
},
81+
{
82+
"metadata": {
83+
"id": "pBTeTbnRKG_k",
84+
"colab_type": "code",
85+
"colab": {}
86+
},
87+
"cell_type": "code",
88+
"source": [
89+
""
90+
],
91+
"execution_count": 0,
92+
"outputs": []
93+
},
5194
{
5295
"metadata": {
5396
"id": "NvoiEwiAWrWy",
@@ -84,11 +127,11 @@
84127
"metadata": {
85128
"id": "Q3FrtesdfyV9",
86129
"colab_type": "code",
130+
"outputId": "1db2fd0d-8904-489e-ac1f-70bc70c9704a",
87131
"colab": {
88132
"base_uri": "https://localhost:8080/",
89133
"height": 925
90-
},
91-
"outputId": "1db2fd0d-8904-489e-ac1f-70bc70c9704a"
134+
}
92135
},
93136
"cell_type": "code",
94137
"source": [
@@ -219,18 +262,18 @@
219262
"metadata": {
220263
"id": "aIbXYrxU8ySd",
221264
"colab_type": "code",
265+
"outputId": "241c61f9-ad81-4c4d-82dd-42bef0502fdf",
222266
"colab": {
223267
"base_uri": "https://localhost:8080/",
224268
"height": 407
225-
},
226-
"outputId": "241c61f9-ad81-4c4d-82dd-42bef0502fdf"
269+
}
227270
},
228271
"cell_type": "code",
229272
"source": [
230273
"!wget https://raw.githubusercontent.com/uchidalab/book-dataset/master/Task1/book30-listing-train.csv\n",
231274
"!wget https://raw.githubusercontent.com/noahgift/recommendations/master/model_definition.yaml"
232275
],
233-
"execution_count": 38,
276+
"execution_count": 0,
234277
"outputs": [
235278
{
236279
"output_type": "stream",
@@ -276,11 +319,11 @@
276319
"metadata": {
277320
"id": "Ef8dbaV4tHrz",
278321
"colab_type": "code",
322+
"outputId": "e7bbaff9-edcf-43df-f142-f8e5e916338f",
279323
"colab": {
280324
"base_uri": "https://localhost:8080/",
281325
"height": 197
282-
},
283-
"outputId": "e7bbaff9-edcf-43df-f142-f8e5e916338f"
326+
}
284327
},
285328
"cell_type": "code",
286329
"source": [
@@ -289,7 +332,7 @@
289332
"df = df.drop(\"Unnamed: 0\", axis=1)\n",
290333
"df.head()"
291334
],
292-
"execution_count": 39,
335+
"execution_count": 0,
293336
"outputs": [
294337
{
295338
"output_type": "execute_result",
@@ -451,17 +494,17 @@
451494
"metadata": {
452495
"id": "KVYJIiwHuhiT",
453496
"colab_type": "code",
497+
"outputId": "c5a39f2f-e99f-4514-8bb8-ebe7c4eee1b1",
454498
"colab": {
455499
"base_uri": "https://localhost:8080/",
456500
"height": 70
457-
},
458-
"outputId": "c5a39f2f-e99f-4514-8bb8-ebe7c4eee1b1"
501+
}
459502
},
460503
"cell_type": "code",
461504
"source": [
462505
"df.columns"
463506
],
464-
"execution_count": 40,
507+
"execution_count": 0,
465508
"outputs": [
466509
{
467510
"output_type": "execute_result",
@@ -493,17 +536,17 @@
493536
"metadata": {
494537
"id": "-kaJsKyruyAl",
495538
"colab_type": "code",
539+
"outputId": "f0e37663-1297-49c0-e000-ec0af6665d43",
496540
"colab": {
497541
"base_uri": "https://localhost:8080/",
498542
"height": 34
499-
},
500-
"outputId": "f0e37663-1297-49c0-e000-ec0af6665d43"
543+
}
501544
},
502545
"cell_type": "code",
503546
"source": [
504547
"df.shape"
505548
],
506-
"execution_count": 41,
549+
"execution_count": 0,
507550
"outputs": [
508551
{
509552
"output_type": "execute_result",
@@ -533,17 +576,17 @@
533576
"metadata": {
534577
"id": "bldBWuL2Nwmh",
535578
"colab_type": "code",
579+
"outputId": "1c6b54c6-35ec-4fa8-b1a5-dd9bcd42b013",
536580
"colab": {
537581
"base_uri": "https://localhost:8080/",
538582
"height": 214
539-
},
540-
"outputId": "1c6b54c6-35ec-4fa8-b1a5-dd9bcd42b013"
583+
}
541584
},
542585
"cell_type": "code",
543586
"source": [
544587
"!head book30-listing-train-with-headers.csv"
545588
],
546-
"execution_count": 42,
589+
"execution_count": 0,
547590
"outputs": [
548591
{
549592
"output_type": "stream",
@@ -567,17 +610,17 @@
567610
"metadata": {
568611
"id": "ous6EqC8Nocg",
569612
"colab_type": "code",
613+
"outputId": "398add9c-ef76-47e2-9fbb-219c8ff1af53",
570614
"colab": {
571615
"base_uri": "https://localhost:8080/",
572616
"height": 212
573-
},
574-
"outputId": "398add9c-ef76-47e2-9fbb-219c8ff1af53"
617+
}
575618
},
576619
"cell_type": "code",
577620
"source": [
578621
"!cat model_definition.yaml"
579622
],
580-
"execution_count": 43,
623+
"execution_count": 0,
581624
"outputs": [
582625
{
583626
"output_type": "stream",
@@ -602,17 +645,17 @@
602645
"metadata": {
603646
"id": "WpVA2fyXLRoK",
604647
"colab_type": "code",
648+
"outputId": "abfc3b5b-6f59-469f-cb7b-aff5e28cb8ca",
605649
"colab": {
606650
"base_uri": "https://localhost:8080/",
607651
"height": 20338
608-
},
609-
"outputId": "abfc3b5b-6f59-469f-cb7b-aff5e28cb8ca"
652+
}
610653
},
611654
"cell_type": "code",
612655
"source": [
613656
"!ludwig experiment --data_csv book30-listing-train-with-headers.csv --model_definition_file model_definition.yaml\n"
614657
],
615-
"execution_count": 3,
658+
"execution_count": 0,
616659
"outputs": [
617660
{
618661
"output_type": "stream",
@@ -1856,7 +1899,7 @@
18561899
"\n",
18571900
"shap.initjs()"
18581901
],
1859-
"execution_count": 45,
1902+
"execution_count": 0,
18601903
"outputs": [
18611904
{
18621905
"output_type": "display_data",
@@ -1934,17 +1977,17 @@
19341977
"metadata": {
19351978
"id": "rKBTIdWgS7Vx",
19361979
"colab_type": "code",
1980+
"outputId": "73a92dc0-1557-47fd-c546-6f7ff38854af",
19371981
"colab": {
19381982
"base_uri": "https://localhost:8080/",
19391983
"height": 34
1940-
},
1941-
"outputId": "73a92dc0-1557-47fd-c546-6f7ff38854af"
1984+
}
19421985
},
19431986
"cell_type": "code",
19441987
"source": [
19451988
"X_train.shape, y_train.shape"
19461989
],
1947-
"execution_count": 47,
1990+
"execution_count": 0,
19481991
"outputs": [
19491992
{
19501993
"output_type": "execute_result",
@@ -1985,7 +2028,7 @@
19852028
"knn = sklearn.neighbors.KNeighborsClassifier()\n",
19862029
"knn.fit(X_train, y_train)"
19872030
],
1988-
"execution_count": 48,
2031+
"execution_count": 0,
19892032
"outputs": [
19902033
{
19912034
"output_type": "execute_result",
@@ -2034,7 +2077,7 @@
20342077
"shap.initjs()\n",
20352078
"shap.force_plot(explainer.expected_value, shap_values_single, X_display.iloc[0,:])"
20362079
],
2037-
"execution_count": 49,
2080+
"execution_count": 0,
20382081
"outputs": [
20392082
{
20402083
"output_type": "stream",
@@ -2142,7 +2185,7 @@
21422185
"source": [
21432186
" !pip install -q scikit-surprise"
21442187
],
2145-
"execution_count": 8,
2188+
"execution_count": 0,
21462189
"outputs": [
21472190
{
21482191
"output_type": "stream",
@@ -2180,7 +2223,7 @@
21802223
"# Run 5-fold cross-validation and print results.\n",
21812224
"cross_validate(algo, data, measures=['RMSE', 'MAE'], cv=5, verbose=True)"
21822225
],
2183-
"execution_count": 33,
2226+
"execution_count": 0,
21842227
"outputs": [
21852228
{
21862229
"output_type": "stream",
@@ -2361,7 +2404,7 @@
23612404
"algo.fit(trainset)\n",
23622405
"\n"
23632406
],
2364-
"execution_count": 51,
2407+
"execution_count": 0,
23652408
"outputs": [
23662409
{
23672410
"output_type": "stream",
@@ -2427,7 +2470,7 @@
24272470
"for movie in toy_story_neighbors:\n",
24282471
" print(movie)\n"
24292472
],
2430-
"execution_count": 52,
2473+
"execution_count": 0,
24312474
"outputs": [
24322475
{
24332476
"output_type": "stream",

0 commit comments

Comments
 (0)