我在尝试使用 Iris-Flowers 数据集进行 Keras 的“Hello World”练习时,无法配置 input_shape。以下是我的错误信息:
"ValueError: Error when checking input: expected dense_1_input to have 3 dimensions, but got array with shape (120, 4)"
当我将 input_shape 更改为接收到的输入形状时,它只是改变了它所说的接收到的输入是什么。正如您所知,这个数据集有 4 个输入和一个输出。有人知道如何配置我的 input_shape 吗?
这是我的代码
我的输入格式化方式是每个数组是一个数据集,每个集合包含 4 个数据点,格式如下:
[['5.1', '3.5', '1.4', '0.2'], ['4.9', '3.0', '1.4', '0.2'], ['4.7', '3.2', '1.3', '0.2']...]
回答:
input_shape=(4,)
输入形状不考虑批量大小,只考虑“每个”样本的大小。