我一直收到这个错误:
Error when checking target: expected dense_256 to have shape (1,) but got array with shape (10,)
我检查了我的X_train变量,得到了(576,10)的形状。所以,我有576个样本,每个样本有10个特征(所有特征都已经缩放)。
我现在试试这个:
classifier = Sequential()
classifier.add(Dense(units = 5, kernel_initializer='uniform', activation = 'relu', input_shape=(10,)))
classifier.add(Dense(units = 5, kernel_initializer='uniform', activation = 'relu'))
classifier.add(Dense(units = 5, kernel_initializer='uniform', activation = 'relu'))
classifier.add(Dense(units = 5, kernel_initializer='uniform', activation = 'relu'))
classifier.add(Dense(units = 1, kernel_initializer='uniform', activation = 'relu'))
classifier.compile(optimizer = 'adam', loss='mean_squared_error', metrics=['mse', 'mae', 'mape'])
classifier.fit(X_train, y_train, batch_size = 10, epochs=100)
当我得到上面引用的input_shape错误时。
所以,我的问题是,在定义input_shape时,如何正确设置?