Skip to content

Commit

Permalink
Merge pull request #2316 from jperk224:patch-1
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 684927870
  • Loading branch information
copybara-github committed Oct 11, 2024
2 parents a45eae2 + d135e81 commit d8930ca
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion site/en/tutorials/keras/regression.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,8 @@
"source": [
"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",
"\n",
"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",
"\n",
"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."
]
},
Expand All @@ -274,7 +276,7 @@
},
"outputs": [],
"source": [
"dataset = pd.get_dummies(dataset, columns=['Origin'], prefix='', prefix_sep='')\n",
"dataset = pd.get_dummies(dataset, columns=['Origin'], prefix='', prefix_sep='', dtype=float)\n",
"dataset.tail()"
]
},
Expand Down

0 comments on commit d8930ca

Please sign in to comment.