简体   繁体   English

keras model.fit函数需要哪种数据格式?

[英]Which data format does keras model.fit function need?

I'm would like to know which data format the model.fit function of keras needs. 我想知道keras需要的model.fit函数采用哪种数据格式。 The documentation is not specific enough for me. 该文档对我来说不够具体。 So it seems, that for an LSTM model it needs a 3D array for the parameter x. 如此看来,对于LSTM模型,它需要一个3D数组作为参数x。 Some more specific questions: Does the data format depend on the chosen model? 一些更具体的问题:数据格式是否取决于所选模型? What is the meaning of each dimension of x? x的每个维度是什么意思? And what is the meaning of y? y的含义是什么?

Thanks in advance for anybody who can tell me a bit about that! 预先感谢任何可以告诉我有关此事的人! Holger 霍尔格

The data format certainly depends on the model. 数据格式当然取决于模型。 You can have models that have multiple inputs, such as Siamese networks. 您可以使用具有多个输入的模型,例如暹罗网络。

In the case of an LSTM, I believe the input is 2-D as in this example . 对于LSTM,我相信此示例中的输入为2-D。 That example loads data from the IMDB dataset . 该示例从IMDB数据集中加载数据。 The relevant line of code there is: 相关的代码行是:

xs = [[oov_char if (w >= num_words or w < skip_top) else w for w in x] for x in xs]

The first dimension corresponds to different examples, and the second dimension is the timestep. 第一维对应于不同的示例,第二维是时间步长。

As for y, that refers to the labels. 至于y,则指的是标签。 In a sequence to sequence example, this would also be two dimensional with the same [example_index, timestep] indexing. 在序列到序列的示例中,这也将是二维的,具有相同的[example_index,timestep]索引。 However, in classification it be 1-dimensional with one label for each example. 但是,在分类中,它是一维的,每个示例带有一个标签。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 带有 Model.Fit() 的 Keras InvalidArgumentError - Keras InvalidArgumentError With Model.Fit() Keras model.fit UnboundLocalError - Keras model.fit UnboundLocalError Tensorflow Keras 中的 model.fit() 方法中的 validation_data 是否必须是一个元组? - does validation_data in model.fit() method in Tensorflow Keras have to be a tuple? 如何将 Keras 中的多个输入的标签赋予 model.fit() function? - How to give labels of multiple inputs in Keras to model.fit() function? 为什么keras中的model.fit函数会显着增加RAM内存? - Why model.fit function in keras significantly increase RAM memory? 当训练数据是图像时,Keras model.fit() 中的“批次”是什么 - what is a “batch” in Keras model.fit() when training data are images Keras:不能使用 ImageDataGenerator 作为 model.fit 中的验证数据 - Keras: cannot use ImageDataGenerator as validation data in model.fit Keras:model.fit 中的详细(值 1)显示较少的训练数据 - Keras: verbose (value 1) in model.fit shows less training data 如何将自定义数据生成器输入到 model.fit 中,它会生成 X,y 和一个额外的数组,到 tensorflow.keras Z20F4ZF011622Z Z20F4ZF35E630DAF39466 - How to input custom data generator into model.fit, which generates X,y and one additional array, into tensorflow.keras model? Tensorflow Keras:在 model.fit() 上进行训练 - Tensorflow Keras: Training Holting on model.fit()
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM