Skip to content

Commit bc6a7ad

Browse files
Merge pull request #2017 from sushreebarsa:patch-16
PiperOrigin-RevId: 427527193
2 parents 6c5d6ef + 1804eb7 commit bc6a7ad

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

site/en/tutorials/load_data/pandas_dataframe.ipynb

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@
205205
"id": "xNxJ41MafiB-"
206206
},
207207
"source": [
208-
"If your data has a uniform datatype, or `dtype`, it's possible use a pandas DataFrame anywhere you could use a NumPy array. This works because the `pandas.DataFrame` class supports the `__array__` protocol, and TensorFlow's `tf.convert_to_tensor` function accepts objects that support the protocol.\n",
208+
"If your data has a uniform datatype, or `dtype`, it's possible to use a pandas DataFrame anywhere you could use a NumPy array. This works because the `pandas.DataFrame` class supports the `__array__` protocol, and TensorFlow's `tf.convert_to_tensor` function accepts objects that support the protocol.\n",
209209
"\n",
210210
"Take the numeric features from the dataset (skip the categorical features for now):"
211211
]
@@ -428,9 +428,9 @@
428428
"id": "NQcp7kiPF8TP"
429429
},
430430
"source": [
431-
"When you start dealing with heterogenous data, it is no longer possible to treat the DataFrame as if it were a single array. TensorFlow tensors require that all elements have the same `dtype`.\n",
431+
"When you start dealing with heterogeneous data, it is no longer possible to treat the DataFrame as if it were a single array. TensorFlow tensors require that all elements have the same `dtype`.\n",
432432
"\n",
433-
"So, in this case, you need to start treating it as a dictionary of columns, where each column has a uniform dtype. A DataFrame is a lot like a dictionary of arrays, so typically all you need to do is cast the DataFrame to a Python dict. Many important TensorFlow APIs support (nested-)dictionaries of arrays as inputs."
433+
"So, in this case, you need to start treating it as a dictionary of columns, where each column has a uniform `dtype`. A DataFrame is a lot like a dictionary of arrays, so typically all you need to do is cast the DataFrame to a Python dict. Many important TensorFlow APIs support (nested-)dictionaries of arrays as inputs."
434434
]
435435
},
436436
{
@@ -491,7 +491,7 @@
491491
"source": [
492492
"Typically, Keras models and layers expect a single input tensor, but these classes can accept and return nested structures of dictionaries, tuples and tensors. These structures are known as \"nests\" (refer to the `tf.nest` module for details).\n",
493493
"\n",
494-
"There are two equivalent ways you can write a keras model that accepts a dictionary as input."
494+
"There are two equivalent ways you can write a Keras model that accepts a dictionary as input."
495495
]
496496
},
497497
{
@@ -545,7 +545,7 @@
545545
" ])\n",
546546
"\n",
547547
" def adapt(self, inputs):\n",
548-
" # Stach the inputs and `adapt` the normalization layer.\n",
548+
" # Stack the inputs and `adapt` the normalization layer.\n",
549549
" inputs = stack_dict(inputs)\n",
550550
" self.normalizer.adapt(inputs)\n",
551551
"\n",
@@ -728,7 +728,7 @@
728728
"id": "zYQ5fDaRxRWQ"
729729
},
730730
"source": [
731-
"It you're passing a heterogenous `DataFrame` to Keras, each column may need unique preprocessing. You could do this preprocessing directly in the DataFrame, but for a model to work correctly, inputs always need to be preprocessed the same way. So, the best approach is to build the preprocessing into the model. [Keras preprocessing layers](https://www.tensorflow.org/guide/keras/preprocessing_layers) cover many common tasks."
731+
"If you're passing a heterogeneous DataFrame to Keras, each column may need unique preprocessing. You could do this preprocessing directly in the DataFrame, but for a model to work correctly, inputs always need to be preprocessed the same way. So, the best approach is to build the preprocessing into the model. [Keras preprocessing layers](https://www.tensorflow.org/guide/keras/preprocessing_layers) cover many common tasks."
732732
]
733733
},
734734
{
@@ -746,9 +746,9 @@
746746
"id": "C6aVQN4Gw-Va"
747747
},
748748
"source": [
749-
"In this dataset some of the \"integer\" features in the raw data are actually Categorical indices. These indices are not really ordered numeric values (refer to the <a href=\"https://archive.ics.uci.edu/ml/datasets/heart+Disease\" class=\"external\">the dataset description</a> for details). Because these are unordered they are inapropriate to feed directly to the model; the model would interpret them as being ordered. To use these inputs you'll need to encode them, either as one-hot vectors or embedding vectors. The same applies to string-categorical features.\n",
749+
"In this dataset some of the \"integer\" features in the raw data are actually Categorical indices. These indices are not really ordered numeric values (refer to the <a href=\"https://archive.ics.uci.edu/ml/datasets/heart+Disease\" class=\"external\">the dataset description</a> for details). Because these are unordered they are inappropriate to feed directly to the model; the model would interpret them as being ordered. To use these inputs you'll need to encode them, either as one-hot vectors or embedding vectors. The same applies to string-categorical features.\n",
750750
"\n",
751-
"Note: If you have many features that need identical preprocessing it's more efficient to concatenate them together befofre applying the preprocessing.\n",
751+
"Note: If you have many features that need identical preprocessing it's more efficient to concatenate them together before applying the preprocessing.\n",
752752
"\n",
753753
"Binary features on the other hand do not generally need to be encoded or normalized.\n",
754754
"\n",
@@ -783,7 +783,7 @@
783783
"id": "HRcC8WkyamJb"
784784
},
785785
"source": [
786-
"The next step is to build a preprocessing model that will apply apropriate preprocessing to each to each input and concatenate the results.\n",
786+
"The next step is to build a preprocessing model that will apply appropriate preprocessing to each input and concatenate the results.\n",
787787
"\n",
788788
"This section uses the [Keras Functional API](https://www.tensorflow.org/guide/keras/functional) to implement the preprocessing. You start by creating one `tf.keras.Input` for each column of the dataframe:"
789789
]
@@ -926,7 +926,7 @@
926926
"id": "Z3wcFs1oKVao"
927927
},
928928
"source": [
929-
"To use categorical features you'll first need to encode them into either binary vectors or embeddings. Since these features only contain a small number of categories, convert the inputs directly to one-hot vectors using the `output_mode='one_hot'` option, supported byy both the `tf.keras.layers.StringLookup` and `tf.keras.layers.IntegerLookup` layers.\n",
929+
"To use categorical features you'll first need to encode them into either binary vectors or embeddings. Since these features only contain a small number of categories, convert the inputs directly to one-hot vectors using the `output_mode='one_hot'` option, supported by both the `tf.keras.layers.StringLookup` and `tf.keras.layers.IntegerLookup` layers.\n",
930930
"\n",
931931
"Here is an example of how these layers work:"
932932
]

0 commit comments

Comments
 (0)