Skip to content

Commit da688e5

Browse files
committed
revised version of sentiment analysis notebook
1 parent 424abb1 commit da688e5

File tree

1 file changed

+26
-8
lines changed

1 file changed

+26
-8
lines changed

notebooks/sentiment-analysis.ipynb

+26-8
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,13 @@
1616
"- Batch Transform: for offline, asynchronous predictions on large batches of data. \n",
1717
"- Instance type choices: many different kinds of CPU and GPU instances are available in SageMaker, and are applicable to different use cases.\n",
1818
"\n",
19-
"***Prerequisites:***\n",
20-
"- In SageMaker Studio, for kernel select **Python 3 (TensorFlow 2.3 Python 3.7 CPU Optimized)**; for a SageMaker Notebook Instance, select the kernel **conda_tensorflow2_py36**.\n",
19+
"### ***Prerequisites***\n",
20+
"\n",
21+
"In SageMaker Studio, for kernel select **Python 3 (Data Science)**; for a SageMaker Notebook Instance, select the kernel **conda_python3**.\n",
2122
"\n",
2223
"# Prepare the dataset\n",
2324
"\n",
24-
"We'll begin by loading the reviews dataset, and padding the reviews so all reviews have the same length. Each review is represented as an array of numbers, where each number represents an indexed word. We'll also pad shorter reviews to match a maximum specified length."
25+
"We'll begin by importing some necessary libraries."
2526
]
2627
},
2728
{
@@ -30,14 +31,30 @@
3031
"metadata": {},
3132
"outputs": [],
3233
"source": [
33-
"!pip install matplotlib==3.4.1\n",
3434
"%matplotlib inline\n",
3535
"\n",
3636
"import logging\n",
3737
"logging.getLogger(\"tensorflow\").setLevel(logging.ERROR)\n",
3838
"import numpy as np\n",
3939
"import os\n",
40+
"import sys\n",
4041
"\n",
42+
"!{sys.executable} -m pip install tensorflow --quiet"
43+
]
44+
},
45+
{
46+
"cell_type": "markdown",
47+
"metadata": {},
48+
"source": [
49+
"Now we'll load the reviews dataset, and pad the reviews so all reviews have the same length. Each review is represented as an array of numbers, where each number represents an indexed word. We'll also pad shorter reviews to match a maximum specified length."
50+
]
51+
},
52+
{
53+
"cell_type": "code",
54+
"execution_count": null,
55+
"metadata": {},
56+
"outputs": [],
57+
"source": [
4158
"from tensorflow.keras.preprocessing import sequence\n",
4259
"from tensorflow.python.keras.datasets import imdb\n",
4360
"\n",
@@ -431,10 +448,11 @@
431448
}
432449
],
433450
"metadata": {
451+
"instance_type": "ml.t3.medium",
434452
"kernelspec": {
435-
"display_name": "conda_tensorflow_p36",
453+
"display_name": "Python 3 (Data Science)",
436454
"language": "python",
437-
"name": "conda_tensorflow_p36"
455+
"name": "python3__SAGEMAKER_INTERNAL__arn:aws:sagemaker:us-west-2:236514542706:image/datascience-1.0"
438456
},
439457
"language_info": {
440458
"codemirror_mode": {
@@ -446,9 +464,9 @@
446464
"name": "python",
447465
"nbconvert_exporter": "python",
448466
"pygments_lexer": "ipython3",
449-
"version": "3.6.10"
467+
"version": "3.7.10"
450468
}
451469
},
452470
"nbformat": 4,
453-
"nbformat_minor": 2
471+
"nbformat_minor": 4
454472
}

0 commit comments

Comments
 (0)