[英]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.