Newby here... I loaded TF
dataset as follows:
dataset = tf.data.TFRecordDataset(files)
dataset.map(extract_fn)
The dataset contains a "string column" with some values and I want to "one-hot" encode them. I could do that in the extract_fn
record by record if I had indices and depth (I only have a String value as of now). However, is there a TF function that could do that for me? i.e.
- Count the number of distinct values
- Map each value to an index
- Create a one-hot encoded column for that