【发布时间】:2018-08-21 07:42:22
【问题描述】:
我从神经网络开始,但我的数据格式存在一些问题。我有一个 pandas DataFrame 和 130 行,4 列,每个数据点都是 595 项目的数组。
| Col 1 | Col 2 | Col 3 | Col 4 |
Row 1 | [x1, ..., x595] | [x1, ..., x595] | [x1, ..., x595] | [x1, ..., x595] |
Row 2 | [x1, ..., x595] | [x1, ..., x595] | [x1, ..., x595] | [x1, ..., x595] |
Row 3 | [x1, ..., x595] | [x1, ..., x595] | [x1, ..., x595] | [x1, ..., x595] |
我使用 train_test_split 创建了 X_train、X_test、y_train 和 y_test .但是,当我检查 X_train 的形状时,它返回 (52,4) 并且我无法为我的 NN 创建模型,因为它不接受这种形状。这是错误:
“ValueError:检查输入时出错:预期的dense_4_input有 3 维,但得到了形状为 (52, 4) 的数组"
我相信这是因为它应该是(52,4,595),对吧?所以,我有点困惑,我怎样才能正确地指定这个 input_format 或者可能为适当的数据格式重塑我的数据?
我正在使用pandas、keras、tensorflow 和 jupyter notebook。
【问题讨论】:
-
请同时添加您的型号代码。
标签: pandas dataframe neural-network keras jupyter-notebook