当我尝试在 LSTM 模型中添加 validation_split 时,出现此错误
ValueError: `validation_split` is only supported for Tensors or NumPy arrays, found: (<tensorflow.python.keras.preprocessing.sequence.TimeseriesGenerator object)
Run Code Online (Sandbox Code Playgroud)
这是代码
ValueError: `validation_split` is only supported for Tensors or NumPy arrays, found: (<tensorflow.python.keras.preprocessing.sequence.TimeseriesGenerator object)
Run Code Online (Sandbox Code Playgroud)
我能想到的一个原因是,要使用validation_split需要张量或numpy 数组,如错误中所述,但是,当通过TimeSeriesGenerator传递训练数据时,它会将训练数据的维度更改为 3D 数组
并且由于TimeSeriesGenerator是使用 LSTM 时必须使用,这是否意味着对于 LSTM 我们不能使用 validation_split