Commit 0f5c10c5 authored by Mark Daoust's avatar Mark Daoust
Browse files

Resolve review comments.

parent 02a30e28
...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
}, },
"cell_type": "markdown", "cell_type": "markdown",
"source": [ "source": [
"# TensorFlow Linear Model Tutorial\n", "# Build a classifier using Estimators\n",
"\n", "\n",
"<table class=\"tfo-notebook-buttons\" align=\"left\"><td>\n", "<table class=\"tfo-notebook-buttons\" align=\"left\"><td>\n",
"<a target=\"_blank\" href=\"https://colab.research.google.com/github/tensorflow/models/blob/master/samples/core/tutorials/estimators/wide.ipynb\">\n", "<a target=\"_blank\" href=\"https://colab.research.google.com/github/tensorflow/models/blob/master/samples/core/tutorials/estimators/wide.ipynb\">\n",
...@@ -75,23 +75,17 @@ ...@@ -75,23 +75,17 @@
"cell_type": "markdown", "cell_type": "markdown",
"source": [ "source": [
"In this tutorial, we will use the `tf.estimator` API in TensorFlow to solve a\n", "In this tutorial, we will use the `tf.estimator` API in TensorFlow to solve a\n",
"standard benchmark binary classification problem: Given census data about a \n", "benchmark binary classification problem.\n",
"person such as age, education, marital status, and occupation (the features),\n",
"we will try to predict whether or not the person earns more than 50,000 dollars\n",
"a year (the target label). We will train a **logistic regression** model, and given \n",
"an individual's information our model will output a number between 0 and 1, which\n",
"can be interpreted as the probability that the individual has an annual income of over\n",
"50,000 dollars.\n",
"\n", "\n",
"Key Point: As a modeler and developer, think about how this data is used and the potential benefits and harm a model's predictions can cause. A model like this could reinforce societal biases and disparities. Is each feature relevant to the problem you want to solve or will it introduce bias? For more information, read about [ML fairness](https://developers.google.com/machine-learning/fairness-overview/).\n", "Estimators are TensorFlow's most scalable and production oriented type of model. For more information see the [Estimator guide](../../guide/estimators).\n",
"\n", "\n",
"## Setup\n", "The problem is: Given census data about a person such as age, education, marital status, and occupation (the features), we will try to predict whether or not the person earns more than 50,000 dollars a year (the target label). We will train a **logistic regression** model, and given an individual's information our model will output a number between 0 and 1, which can be interpreted as the probability that the individual has an annual income of over 50,000 dollars.\n",
"\n", "\n",
"To try the code for this tutorial:\n", "Key Point: As a modeler and developer, think about how this data is used and the potential benefits and harm a model's predictions can cause. A model like this could reinforce societal biases and disparities. Is each feature relevant to the problem you want to solve or will it introduce bias? For more information, read about [ML fairness](https://developers.google.com/machine-learning/fairness-overview/).\n",
"\n", "\n",
"[Install TensorFlow](tensorlfow.org/install) if you haven't already.\n", "## Setup\n",
"\n", "\n",
"Next import the relavant packages:" "To try this tutorial, first import the relavant packages:"
] ]
}, },
{ {
...@@ -119,6 +113,17 @@ ...@@ -119,6 +113,17 @@
"colab_type": "text" "colab_type": "text"
}, },
"cell_type": "markdown", "cell_type": "markdown",
"source": [
"## Official implementation\n",
"\n"
]
},
{
"metadata": {
"id": "tJqF5E6rtyCI",
"colab_type": "text"
},
"cell_type": "markdown",
"source": [ "source": [
"Download the [tutorial code from github](https://github.com/tensorflow/models/tree/master/official/wide_deep/),\n", "Download the [tutorial code from github](https://github.com/tensorflow/models/tree/master/official/wide_deep/),\n",
" add the root directory to your python path, and jump to the `wide_deep` directory:" " add the root directory to your python path, and jump to the `wide_deep` directory:"
...@@ -159,7 +164,7 @@ ...@@ -159,7 +164,7 @@
}, },
"cell_type": "markdown", "cell_type": "markdown",
"source": [ "source": [
"Execute the data download script:" "Download the dataset:"
] ]
}, },
{ {
...@@ -185,6 +190,10 @@ ...@@ -185,6 +190,10 @@
}, },
"cell_type": "markdown", "cell_type": "markdown",
"source": [ "source": [
"### Command line usage\n",
"\n",
"The repo includes a complete program for experimenting with this type of model.\n",
"\n",
"To execute the tutorial code from the command line first add the path to tensorflow/models to your `PYTHONPATH`." "To execute the tutorial code from the command line first add the path to tensorflow/models to your `PYTHONPATH`."
] ]
}, },
...@@ -248,6 +257,16 @@ ...@@ -248,6 +257,16 @@
"execution_count": 0, "execution_count": 0,
"outputs": [] "outputs": []
}, },
{
"metadata": {
"id": "Uo2qoafut4MK",
"colab_type": "text"
},
"cell_type": "markdown",
"source": [
"Read on to find out how this code builds its models."
]
},
{ {
"metadata": { "metadata": {
"id": "AmZ4CpaOcYvV", "id": "AmZ4CpaOcYvV",
...@@ -255,8 +274,6 @@ ...@@ -255,8 +274,6 @@
}, },
"cell_type": "markdown", "cell_type": "markdown",
"source": [ "source": [
"Read on to find out how this code builds its linear model.\n",
"\n",
"## Reading The Census Data\n", "## Reading The Census Data\n",
"\n", "\n",
"The dataset we're using is the\n", "The dataset we're using is the\n",
...@@ -1302,28 +1319,16 @@ ...@@ -1302,28 +1319,16 @@
}, },
"cell_type": "markdown", "cell_type": "markdown",
"source": [ "source": [
"## What Next\n", "## Next Steps\n",
"\n", "\n",
"For more about estimators:\n", "For more about estimators see:\n",
"\n", "\n",
"- The [TensorFlow Hub text classification tutorial](https://www.tensorflow.org/hub/tutorials/text_classification_with_tf_hub) uses `hub.text_embedding_column` to easily ingest free form text. \n", "- The [Estimator Guide](tensorlfow.org/guide/estimators).\n",
"- The [TensorFlow Hub text classification tutorial](https://www.tensorflow.org/hub/tutorials/text_classification_with_tf_hub), which uses `hub.text_embedding_column` to easily ingest free form text. \n",
"- The [Gradient-boosted-trees estimator tutorial](https://github.com/tensorflow/models/tree/master/official/boosted_trees)\n", "- The [Gradient-boosted-trees estimator tutorial](https://github.com/tensorflow/models/tree/master/official/boosted_trees)\n",
"- This [blog post]( https://medium.com/tensorflow/classifying-text-with-tensorflow-estimators) on processing text with `Estimators`\n", "- This [blog post]( https://medium.com/tensorflow/classifying-text-with-tensorflow-estimators) on processing text with `Estimators`\n",
"- How to [build a custom CNN estimator](https://www.tensorflow.org/tutorials/estimators/cnn)" "- How to [build a custom CNN estimator](https://www.tensorflow.org/tutorials/estimators/cnn)"
] ]
},
{
"metadata": {
"id": "amMnupRPVtsa",
"colab_type": "code",
"colab": {}
},
"cell_type": "code",
"source": [
""
],
"execution_count": 0,
"outputs": []
} }
] ]
} }
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment