|
16 | 16 | "- Batch Transform: for offline, asynchronous predictions on large batches of data. \n",
|
17 | 17 | "- Instance type choices: many different kinds of CPU and GPU instances are available in SageMaker, and are applicable to different use cases.\n",
|
18 | 18 | "\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", |
21 | 22 | "\n",
|
22 | 23 | "# Prepare the dataset\n",
|
23 | 24 | "\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." |
25 | 26 | ]
|
26 | 27 | },
|
27 | 28 | {
|
|
30 | 31 | "metadata": {},
|
31 | 32 | "outputs": [],
|
32 | 33 | "source": [
|
33 |
| - "!pip install matplotlib==3.4.1\n", |
34 | 34 | "%matplotlib inline\n",
|
35 | 35 | "\n",
|
36 | 36 | "import logging\n",
|
37 | 37 | "logging.getLogger(\"tensorflow\").setLevel(logging.ERROR)\n",
|
38 | 38 | "import numpy as np\n",
|
39 | 39 | "import os\n",
|
| 40 | + "import sys\n", |
40 | 41 | "\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": [ |
41 | 58 | "from tensorflow.keras.preprocessing import sequence\n",
|
42 | 59 | "from tensorflow.python.keras.datasets import imdb\n",
|
43 | 60 | "\n",
|
|
431 | 448 | }
|
432 | 449 | ],
|
433 | 450 | "metadata": {
|
| 451 | + "instance_type": "ml.t3.medium", |
434 | 452 | "kernelspec": {
|
435 |
| - "display_name": "conda_tensorflow_p36", |
| 453 | + "display_name": "Python 3 (Data Science)", |
436 | 454 | "language": "python",
|
437 |
| - "name": "conda_tensorflow_p36" |
| 455 | + "name": "python3__SAGEMAKER_INTERNAL__arn:aws:sagemaker:us-west-2:236514542706:image/datascience-1.0" |
438 | 456 | },
|
439 | 457 | "language_info": {
|
440 | 458 | "codemirror_mode": {
|
|
446 | 464 | "name": "python",
|
447 | 465 | "nbconvert_exporter": "python",
|
448 | 466 | "pygments_lexer": "ipython3",
|
449 |
| - "version": "3.6.10" |
| 467 | + "version": "3.7.10" |
450 | 468 | }
|
451 | 469 | },
|
452 | 470 | "nbformat": 4,
|
453 |
| - "nbformat_minor": 2 |
| 471 | + "nbformat_minor": 4 |
454 | 472 | }
|
0 commit comments