Skip to content

Commit 00b7460

Browse files
Merge pull request #2142 from synandi:patch-16
PiperOrigin-RevId: 483755179
2 parents a077cd6 + 401838c commit 00b7460

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

site/en/guide/migrate/canned_estimators.ipynb

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,15 @@
6767
"source": [
6868
"Canned (or Premade) Estimators have traditionally been used in TensorFlow 1 as quick and easy ways to train models for a variety of typical use cases. TensorFlow 2 provides straightforward approximate substitutes for a number of them by way of Keras models. For those canned estimators that do not have built-in TensorFlow 2 substitutes, you can still build your own replacement fairly easily.\n",
6969
"\n",
70-
"This guide walks through a few examples of direct equivalents and custom substitutions to demonstrate how TensorFlow 1's `tf.estimator`-derived models can be migrated to TF2 with Keras.\n",
70+
"This guide will walk you through a few examples of direct equivalents and custom substitutions to demonstrate how TensorFlow 1's `tf.estimator`-derived models can be migrated to TensorFlow 2 with Keras.\n",
7171
"\n",
7272
"Namely, this guide includes examples for migrating:\n",
7373
"* From `tf.estimator`'s `LinearEstimator`, `Classifier` or `Regressor` in TensorFlow 1 to Keras `tf.compat.v1.keras.models.LinearModel` in TensorFlow 2\n",
7474
"* From `tf.estimator`'s `DNNEstimator`, `Classifier` or `Regressor` in TensorFlow 1 to a custom Keras DNN ModelKeras in TensorFlow 2\n",
7575
"* From `tf.estimator`'s `DNNLinearCombinedEstimator`, `Classifier` or `Regressor` in TensorFlow 1 to `tf.compat.v1.keras.models.WideDeepModel` in TensorFlow 2\n",
7676
"* From `tf.estimator`'s `BoostedTreesEstimator`, `Classifier` or `Regressor` in TensorFlow 1 to `tfdf.keras.GradientBoostedTreesModel` in TensorFlow 2\n",
7777
"\n",
78-
"A common precursor to the training of a model is feature preprocessing, which is done for TensorFlow 1 Estimator models with `tf.feature_column`. For more information on feature preprocessing in TensorFlow 2, check out [this guide on migrating from feature columns to the Keras preprocessing layers API](migrating_feature_columns.ipynb)."
78+
"A common precursor to the training of a model is feature preprocessing, which is done for TensorFlow 1 Estimator models with `tf.feature_column`. For more information on feature preprocessing in TensorFlow 2, see [this guide on migrating from feature columns to the Keras preprocessing layers API](migrating_feature_columns.ipynb)."
7979
]
8080
},
8181
{
@@ -183,7 +183,7 @@
183183
"id": "bYSgoezeMrpI"
184184
},
185185
"source": [
186-
"and create a method to instantiate a simplistic sample optimizer to use with our various TensorFlow 1 Estimator and TensorFlow 2 Keras models."
186+
"and create a method to instantiate a simplistic sample optimizer to use with various TensorFlow 1 Estimator and TensorFlow 2 Keras models."
187187
]
188188
},
189189
{
@@ -226,7 +226,7 @@
226226
"id": "_O7fyhCnpvED"
227227
},
228228
"source": [
229-
"### TF1: Using LinearEstimator"
229+
"### TensorFlow 1: Using LinearEstimator"
230230
]
231231
},
232232
{
@@ -270,7 +270,7 @@
270270
"id": "KEmzBjfnsxwT"
271271
},
272272
"source": [
273-
"### TF2: Using Keras LinearModel"
273+
"### TensorFlow 2: Using Keras LinearModel"
274274
]
275275
},
276276
{
@@ -311,7 +311,7 @@
311311
"id": "YKl6XZ7Bp1t5"
312312
},
313313
"source": [
314-
"### TF1: Using DNNEstimator"
314+
"### TensorFlow 1: Using DNNEstimator"
315315
]
316316
},
317317
{
@@ -320,7 +320,7 @@
320320
"id": "J7wJUmgypln8"
321321
},
322322
"source": [
323-
"In TensorFlow 1, you can use `tf.estimator.DNNEstimator` to create a baseline DNN model for regression and classification problems."
323+
"In TensorFlow 1, you can use `tf.estimator.DNNEstimator` to create a baseline deep neural network (DNN) model for regression and classification problems."
324324
]
325325
},
326326
{
@@ -357,7 +357,7 @@
357357
"id": "6xJz6px6pln-"
358358
},
359359
"source": [
360-
"### TF2: Using Keras to create a custom DNN model"
360+
"### TensorFlow 2: Using Keras to create a custom DNN model"
361361
]
362362
},
363363
{
@@ -368,7 +368,7 @@
368368
"source": [
369369
"In TensorFlow 2, you can create a custom DNN model to substitute for one generated by `tf.estimator.DNNEstimator`, with similar levels of user-specified customization (for instance, as in the previous example, the ability to customize a chosen model optimizer).\n",
370370
"\n",
371-
"A similar workflow can be used to replace `tf.estimator.experimental.RNNEstimator` with a Keras RNN Model. Keras provides a number of built-in, customizable choices by way of `tf.keras.layers.RNN`, `tf.keras.layers.LSTM`, and `tf.keras.layers.GRU`. Refer to _Built-in RNN layers: a simple example_ in the [RNN with Keras guide](https://www.tensorflow.org/guide/keras/rnn#built-in_rnn_layers_a_simple_example) for more details."
371+
"A similar workflow can be used to replace `tf.estimator.experimental.RNNEstimator` with a Keras recurrent neural network (RNN) model. Keras provides a number of built-in, customizable choices by way of `tf.keras.layers.RNN`, `tf.keras.layers.LSTM`, and `tf.keras.layers.GRU`. To learn more, check out the _Built-in RNN layers: a simple example_ section of [RNN with Keras guide](https://www.tensorflow.org/guide/keras/rnn)."
372372
]
373373
},
374374
{
@@ -413,7 +413,7 @@
413413
"id": "GfRaObf5g4TU"
414414
},
415415
"source": [
416-
"### TF1: Using DNNLinearCombinedEstimator"
416+
"### TensorFlow 1: Using DNNLinearCombinedEstimator"
417417
]
418418
},
419419
{
@@ -464,7 +464,7 @@
464464
"id": "BeMikL5ug4TX"
465465
},
466466
"source": [
467-
"### TF2: Using Keras WideDeepModel"
467+
"### TensorFlow 2: Using Keras WideDeepModel"
468468
]
469469
},
470470
{
@@ -477,7 +477,7 @@
477477
"\n",
478478
"This `WideDeepModel` is constructed on the basis of a constituent `LinearModel` and a custom DNN Model, both of which are discussed in the preceding two examples. A custom linear model can also be used in place of the built-in Keras `LinearModel` if desired.\n",
479479
"\n",
480-
"If you would like to build your own model instead of a canned estimator, check out [how to build a `keras.Sequential` model](https://www.tensorflow.org/guide/keras/sequential_model). For more information on custom training and optimizers you can also checkout [this guide](https://www.tensorflow.org/tutorials/customization/custom_training_walkthrough)."
480+
"If you would like to build your own model instead of using a canned estimator, check out the [Keras Sequential model](https://www.tensorflow.org/guide/keras/sequential_model) guide. For more information on custom training and optimizers, check out the [Custom training: walkthrough](https://www.tensorflow.org/tutorials/customization/custom_training_walkthrough) guide."
481481
]
482482
},
483483
{
@@ -488,7 +488,7 @@
488488
},
489489
"outputs": [],
490490
"source": [
491-
"# Create a LinearModel and a DNN model as in Examples 1 and 2\n",
491+
"# Create LinearModel and DNN Model as in Examples 1 and 2\n",
492492
"optimizer = create_sample_optimizer('tf2')\n",
493493
"\n",
494494
"linear_model = tf.compat.v1.keras.experimental.LinearModel()\n",
@@ -532,7 +532,7 @@
532532
"id": "_3mCQVDSeOKD"
533533
},
534534
"source": [
535-
"### TF1: Using BoostedTreesEstimator"
535+
"### TensorFlow 1: Using BoostedTreesEstimator"
536536
]
537537
},
538538
{
@@ -578,7 +578,7 @@
578578
"id": "eNuLP6BeeOKF"
579579
},
580580
"source": [
581-
"### TF2: Using TensorFlow Decision Forests"
581+
"### TensorFlow 2: Using TensorFlow Decision Forests"
582582
]
583583
},
584584
{
@@ -634,7 +634,7 @@
634634
"train_dataframe = pd.read_csv('https://storage.googleapis.com/tf-datasets/titanic/train.csv')\n",
635635
"eval_dataframe = pd.read_csv('https://storage.googleapis.com/tf-datasets/titanic/eval.csv')\n",
636636
"\n",
637-
"# Convert the pandas Dataframes into TensorFlow datasets.\n",
637+
"# Convert the Pandas Dataframes into TensorFlow datasets.\n",
638638
"train_dataset = tfdf.keras.pd_dataframe_to_tf_dataset(train_dataframe, label=\"survived\")\n",
639639
"eval_dataset = tfdf.keras.pd_dataframe_to_tf_dataset(eval_dataframe, label=\"survived\")"
640640
]
@@ -691,7 +691,7 @@
691691
"source": [
692692
"Gradient Boosted Trees is just one of the many decision forest algorithms available in TensorFlow Decision Forests. For example, Random Forests (available as [tfdf.keras.GradientBoostedTreesModel](https://www.tensorflow.org/decision_forests/api_docs/python/tfdf/keras/RandomForestModel) is very resistant to overfitting) while CART (available as [tfdf.keras.CartModel](https://www.tensorflow.org/decision_forests/api_docs/python/tfdf/keras/CartModel)) is great for model interpretation.\n",
693693
"\n",
694-
"In the next example, you'll train and plot a Random Forest model."
694+
"In the next example, train and plot a Random Forest model."
695695
]
696696
},
697697
{
@@ -718,7 +718,7 @@
718718
"id": "Z0QYolhoZb_k"
719719
},
720720
"source": [
721-
"In the final example, you'll train and evaluate a CART model."
721+
"In the final example, train and evaluate a CART model."
722722
]
723723
},
724724
{

0 commit comments

Comments
 (0)