Skip to content

10. Time series - Try to reproduce the 'Windowing dataset' section with tf.keras.preprocessing.timeseries_dataset_from_array() #199

Answered by mrdbourke
remy-r asked this question in Q&A
Discussion options

You must be logged in to vote

Edit: @remy-r has discovered the difference is because NumPy arrays are shuffled (shuffled=True) by default when using the fit() function - https://www.tensorflow.org/api_docs/python/tf/keras/Model#fit

However when using tf.data.Dataset objects such as with tf.keras.utils.timeseries_dataset_from_array(), the shuffle parameter in fit() gets ignored.

This explains the different outcomes of results.

When tf.data.Dataset objects are shuffled manually with .shuffle(), the results start to line up.

See the comment below for more: #199 (reply in thread)


Hey there,

Massive effort giving this a go.

I'd say the difference could be coming from when you create your train/test sets.

You may have to m…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@remy-r
Comment options

@mrdbourke
Comment options

@remy-r
Comment options

@mrdbourke
Comment options

Answer selected by mrdbourke
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants