" <img src=\"https://www.tensorflow.org/images/colab_logo_32px.png\" /><span>Run in Google Colab</span></a> \n",
"</td><td>\n",
"<a target=\"_blank\" href=\"https://github.com/tensorflow/models/blob/master/samples/core/get_started/eager.ipynb\"><img width=32px src=\"https://www.tensorflow.org/images/GitHub-Mark-32px.png\" /><span>View source on GitHub</span></a></td></table>\n",
"\n"
"<a target=\"_blank\" href=\"https://github.com/tensorflow/models/blob/master/samples/core/get_started/eager.ipynb\"><img width=32px src=\"https://www.tensorflow.org/images/GitHub-Mark-32px.png\" /><span>View source on GitHub</span></a></td></table>"
]
},
{
...
...
@@ -76,16 +82,14 @@
},
"cell_type": "markdown",
"source": [
"This guide uses machine learning to *categorize* Iris flowers by species. It uses [TensorFlow](https://www.tensorflow.org)'s eager execution to:\n",
"This guide uses machine learning to *categorize* Iris flowers by species. It uses TensorFlow's [eager execution](https://www.tensorflow.org/guide/eager) to:\n",
"1. Build a model,\n",
"2. Train this model on example data, and\n",
"3. Use the model to make predictions about unknown data.\n",
"\n",
"Machine learning experience isn't required, but you'll need to read some Python code. For more eager execution guides and examples, see [these notebooks](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/eager/python/examples/notebooks).\n",
"\n",
"## TensorFlow programming\n",
"\n",
"There are many [TensorFlow APIs](https://www.tensorflow.org/api_docs/python/) available, but start with these high-level TensorFlow concepts:\n",
"This guide uses these high-level TensorFlow concepts:\n",
"\n",
"* Enable an [eager execution](https://www.tensorflow.org/guide/eager) development environment,\n",
"* Import data with the [Datasets API](https://www.tensorflow.org/guide/datasets),\n",
...
...
@@ -97,18 +101,7 @@
"2. Select the type of model.\n",
"3. Train the model.\n",
"4. Evaluate the model's effectiveness.\n",
"5. Use the trained model to make predictions.\n",
"\n",
"For more TensorFlow examples, see the [Get Started](https://www.tensorflow.org/get_started/) and [Tutorials](https://www.tensorflow.org/tutorials/) sections. To learn machine learning basics, consider taking the [Machine Learning Crash Course](https://developers.google.com/machine-learning/crash-course/).\n",
"\n",
"## Run the notebook\n",
"\n",
"This tutorial is available as an interactive [Colab notebook](https://colab.research.google.com) that can execute and modify Python code directly in the browser. The notebook handles setup and dependencies while you \"play\" cells to run the code blocks. This is a fun way to explore the program and test ideas.\n",
"\n",
"If you are unfamiliar with Python notebook environments, there are a couple of things to keep in mind:\n",
"\n",
"1. Executing code requires connecting to a runtime environment. In the Colab notebook menu, select *Runtime > Connect to runtime...*\n",
"2. Notebook cells are arranged sequentially to gradually build the program. Typically, later code cells depend on prior code cells, though you can always rerun a code block. To execute the entire notebook in order, select *Runtime > Run all*. To rerun a code cell, select the cell and click the *play icon* on the left."
"5. Use the trained model to make predictions."
]
},
{
...
...
@@ -121,31 +114,6 @@
"## Setup program"
]
},
{
"metadata": {
"id": "6qoYFqQ89aV3",
"colab_type": "text"
},
"cell_type": "markdown",
"source": [
"### Install the latest version of TensorFlow\n",
"\n",
"This tutorial uses eager execution, which is available in [TensorFlow 1.8](https://www.tensorflow.org/install/). (You may need to restart the runtime after upgrading.)"
]
},
{
"metadata": {
"id": "jBmKxLVy9Uhg",
"colab_type": "code",
"colab": {}
},
"cell_type": "code",
"source": [
"!pip install --upgrade tensorflow"
],
"execution_count": 0,
"outputs": []
},
{
"metadata": {
"id": "1J3AuPBT9gyR",
...
...
@@ -155,7 +123,7 @@
"source": [
"### Configure imports and eager execution\n",
"\n",
"Import the required Python modules—including TensorFlow—and enable eager execution for this program. Eager execution makes TensorFlow evaluate operations immediately, returning concrete values instead of creating a [computational graph](https://www.tensorflow.org/guide/graphs) that is executed later. If you are used to a REPL or the `python` interactive console, this feels familiar.\n",
"Import the required Python modules—including TensorFlow—and enable eager execution for this program. Eager execution makes TensorFlow evaluate operations immediately, returning concrete values instead of creating a [computational graph](https://www.tensorflow.org/guide/graphs) that is executed later. If you are used to a REPL or the `python` interactive console, this feels familiar. Eager execution is available in [Tensorlow >=1.8](https://www.tensorflow.org/install/).\n",
"\n",
"Once eager execution is enabled, it *cannot* be disabled within the same program. See the [eager execution guide](https://www.tensorflow.org/guide/eager) for more details."
]
...
...
@@ -164,7 +132,12 @@
"metadata": {
"id": "g4Wzg69bnwK2",
"colab_type": "code",
"colab": {}
"colab": {
"autoexec": {
"startup": false,
"wait_interval": 0
}
}
},
"cell_type": "code",
"source": [
...
...
@@ -234,7 +207,12 @@
"metadata": {
"id": "J6c7uEU9rjRM",
"colab_type": "code",
"colab": {}
"colab": {
"autoexec": {
"startup": false,
"wait_interval": 0
}
}
},
"cell_type": "code",
"source": [
...
...
@@ -264,7 +242,12 @@
"metadata": {
"id": "FQvb_JYdrpPm",
"colab_type": "code",
"colab": {}
"colab": {
"autoexec": {
"startup": false,
"wait_interval": 0
}
}
},
"cell_type": "code",
"source": [
...
...
@@ -295,7 +278,12 @@
"metadata": {
"id": "9Edhevw7exl6",
"colab_type": "code",
"colab": {}
"colab": {
"autoexec": {
"startup": false,
"wait_interval": 0
}
}
},
"cell_type": "code",
"source": [
...
...
@@ -331,7 +319,12 @@
"metadata": {
"id": "sVNlJlUOhkoX",
"colab_type": "code",
"colab": {}
"colab": {
"autoexec": {
"startup": false,
"wait_interval": 0
}
}
},
"cell_type": "code",
"source": [
...
...
@@ -359,7 +352,12 @@
"metadata": {
"id": "WsxHnz1ebJ2S",
"colab_type": "code",
"colab": {}
"colab": {
"autoexec": {
"startup": false,
"wait_interval": 0
}
}
},
"cell_type": "code",
"source": [
...
...
@@ -391,7 +389,12 @@
"metadata": {
"id": "iDuG94H-C122",
"colab_type": "code",
"colab": {}
"colab": {
"autoexec": {
"startup": false,
"wait_interval": 0
}
}
},
"cell_type": "code",
"source": [
...
...
@@ -418,7 +421,12 @@
"metadata": {
"id": "me5Wn-9FcyyO",
"colab_type": "code",
"colab": {}
"colab": {
"autoexec": {
"startup": false,
"wait_interval": 0
}
}
},
"cell_type": "code",
"source": [
...
...
@@ -449,7 +457,12 @@
"metadata": {
"id": "jm932WINcaGU",
"colab_type": "code",
"colab": {}
"colab": {
"autoexec": {
"startup": false,
"wait_interval": 0
}
}
},
"cell_type": "code",
"source": [
...
...
@@ -475,7 +488,12 @@
"metadata": {
"id": "ZbDkzGZIkpXf",
"colab_type": "code",
"colab": {}
"colab": {
"autoexec": {
"startup": false,
"wait_interval": 0
}
}
},
"cell_type": "code",
"source": [
...
...
@@ -498,7 +516,12 @@
"metadata": {
"id": "kex9ibEek6Tr",
"colab_type": "code",
"colab": {}
"colab": {
"autoexec": {
"startup": false,
"wait_interval": 0
}
}
},
"cell_type": "code",
"source": [
...
...
@@ -559,7 +582,12 @@
"metadata": {
"id": "2fZ6oL2ig3ZK",
"colab_type": "code",
"colab": {}
"colab": {
"autoexec": {
"startup": false,
"wait_interval": 0
}
}
},
"cell_type": "code",
"source": [
...
...
@@ -600,7 +628,12 @@
"metadata": {
"id": "xe6SQ5NrpB-I",
"colab_type": "code",
"colab": {}
"colab": {
"autoexec": {
"startup": false,
"wait_interval": 0
}
}
},
"cell_type": "code",
"source": [
...
...
@@ -626,7 +659,12 @@
"metadata": {
"id": "_tRwHZmTNTX2",
"colab_type": "code",
"colab": {}
"colab": {
"autoexec": {
"startup": false,
"wait_interval": 0
}
}
},
"cell_type": "code",
"source": [
...
...
@@ -649,7 +687,12 @@
"metadata": {
"id": "-Jzm_GoErz8B",
"colab_type": "code",
"colab": {}
"colab": {
"autoexec": {
"startup": false,
"wait_interval": 0
}
}
},
"cell_type": "code",
"source": [
...
...
@@ -691,7 +734,12 @@
"metadata": {
"id": "tMAT4DcMPwI-",
"colab_type": "code",
"colab": {}
"colab": {
"autoexec": {
"startup": false,
"wait_interval": 0
}
}
},
"cell_type": "code",
"source": [
...
...
@@ -720,7 +768,12 @@
"metadata": {
"id": "x57HcKWhKkei",
"colab_type": "code",
"colab": {}
"colab": {
"autoexec": {
"startup": false,
"wait_interval": 0
}
}
},
"cell_type": "code",
"source": [
...
...
@@ -770,7 +823,12 @@
"metadata": {
"id": "8xxi2NNGKwG_",
"colab_type": "code",
"colab": {}
"colab": {
"autoexec": {
"startup": false,
"wait_interval": 0
}
}
},
"cell_type": "code",
"source": [
...
...
@@ -795,7 +853,12 @@
"metadata": {
"id": "rxRNTFVe56RG",
"colab_type": "code",
"colab": {}
"colab": {
"autoexec": {
"startup": false,
"wait_interval": 0
}
}
},
"cell_type": "code",
"source": [
...
...
@@ -837,7 +900,12 @@
"metadata": {
"id": "AIgulGRUhpto",
"colab_type": "code",
"colab": {}
"colab": {
"autoexec": {
"startup": false,
"wait_interval": 0
}
}
},
"cell_type": "code",
"source": [
...
...
@@ -903,7 +971,12 @@
"metadata": {
"id": "agjvNd2iUGFn",
"colab_type": "code",
"colab": {}
"colab": {
"autoexec": {
"startup": false,
"wait_interval": 0
}
}
},
"cell_type": "code",
"source": [
...
...
@@ -983,7 +1056,12 @@
"metadata": {
"id": "Ps3_9dJ3Lodk",
"colab_type": "code",
"colab": {}
"colab": {
"autoexec": {
"startup": false,
"wait_interval": 0
}
}
},
"cell_type": "code",
"source": [
...
...
@@ -999,7 +1077,12 @@
"metadata": {
"id": "SRMWCu30bnxH",
"colab_type": "code",
"colab": {}
"colab": {
"autoexec": {
"startup": false,
"wait_interval": 0
}
}
},
"cell_type": "code",
"source": [
...
...
@@ -1032,7 +1115,12 @@
"metadata": {
"id": "Tw03-MK1cYId",
"colab_type": "code",
"colab": {}
"colab": {
"autoexec": {
"startup": false,
"wait_interval": 0
}
}
},
"cell_type": "code",
"source": [
...
...
@@ -1062,7 +1150,12 @@
"metadata": {
"id": "uNwt2eMeOane",
"colab_type": "code",
"colab": {}
"colab": {
"autoexec": {
"startup": false,
"wait_interval": 0
}
}
},
"cell_type": "code",
"source": [
...
...
@@ -1093,7 +1186,12 @@
"metadata": {
"id": "kesTS5Lzv-M2",
"colab_type": "code",
"colab": {}
"colab": {
"autoexec": {
"startup": false,
"wait_interval": 0
}
}
},
"cell_type": "code",
"source": [
...
...
@@ -1113,30 +1211,6 @@
],
"execution_count": 0,
"outputs": []
},
{
"metadata": {
"id": "HUZEWdD9zupu",
"colab_type": "text"
},
"cell_type": "markdown",
"source": [
"These predictions look good!\n",
"\n",
"To dig deeper into machine learning models, take a look at the [TensorFlow Guide](https://www.tensorflow.org/guide/) and check out the [community](https://www.tensorflow.org/community/)."
]
},
{
"metadata": {
"id": "xJAYB2eSWcTv",
"colab_type": "text"
},
"cell_type": "markdown",
"source": [
"## Next steps\n",
"\n",
"For more eager execution guides and examples, see [these notebooks](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/eager/python/examples/notebooks)."