Skip to content

Commit d135e81

Browse files
committed
Add reference to Tensor object.
Change the verbiage slightly to include reference to the Tensor docs and note the nature of the object needing uniform data types.
1 parent fe0d285 commit d135e81

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

site/en/tutorials/keras/regression.ipynb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,8 @@
251251
},
252252
"source": [
253253
"The `\"Origin\"` column is categorical, not numeric. So the next step is to one-hot encode the values in the column with [pd.get_dummies](https://pandas.pydata.org/docs/reference/api/pandas.get_dummies.html).\n",
254-
"Neglecting to specify a data type by way of a `dtype` argument will leave you with boolean values, causing errors during normalization if the feature values are not cast when passing them into to `tf.keras.layers.Normalization.adapt()`.\n",
254+
"\n",
255+
"Neglecting to specify a data type by way of a `dtype` argument will leave you with boolean values, causing errors during normalization when instantiating the Tensor object if the feature values are not cast to a uniform type when passing the array into `tf.keras.layers.Normalization.adapt()`. [Tensor objects](https://www.tensorflow.org/guide/tensor) must house uniform data types.\n",
255256
"\n",
256257
"Note: You can set up the `tf.keras.Model` to do this kind of transformation for you but that's beyond the scope of this tutorial. Check out the [Classify structured data using Keras preprocessing layers](../structured_data/preprocessing_layers.ipynb) or [Load CSV data](../load_data/csv.ipynb) tutorials for examples."
257258
]
@@ -275,7 +276,7 @@
275276
},
276277
"outputs": [],
277278
"source": [
278-
"dataset = pd.get_dummies(dataset, columns=['Origin'], prefix='', prefix_sep='', dtype=int)\n",
279+
"dataset = pd.get_dummies(dataset, columns=['Origin'], prefix='', prefix_sep='', dtype=float)\n",
279280
"dataset.tail()"
280281
]
281282
},

0 commit comments

Comments
 (0)