In this post, we will see how to resolve Keras timeseries_dataset_from_array with multiple column types?
Question:
For a LSTM, I would like to usetensorflow.keras.utils.timeseries_dataset_from_array()
to create sequences of training data samples. My training data contains multiple data types (numerical, categorical) which I would like to preprocess by means of Keras’ preprocessing layers within the neural network.
However, it seems to me that timeseries_dataset_from_array()
is not compatible with columns with different data types, although the documentation does not tell this:ValueError: Failed to convert a NumPy array to a Tensor (Unsupported object type int).
So, can you only use data of the same type with timeseries_dataset_from_array()? And if so, what can I do if I want to create training data sequences of multiple data types?
Best Answer:
I think that this answer sums it up nicely: A tensor can’t have different data types.If you have better answer, please add a comment about this, thank you!
Source: Stackoverflow.com
Leave a Review