我正在使用神经网络。当我尝试将预测与测试集中的实际值进行比较时,我无法做到这一点,因为它不允许我创建包含预测的数据帧。所以基本上我无法得到 test_predictions.shape = (10092,) 而不是 o (10092,1)。这个“1”给我带来了所有的麻烦。有人可以帮忙吗?X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.7, random_state=101)model = keras.Sequential()model.add(Dense(500,activation='relu'))model.add(Dense(500,activation='relu'))model.add(Dense(500,activation='relu'))model.add(Dense(1))model.compile(optimizer='rmsprop',loss = 'mse')model.fit(X_train, y_train, epochs=100, batch_size=25, verbose=1, validation_split=0.2)test_predictions = model.predict(X_test)y_test = pd.Series(y_test)test_predictions = pd.Series(test_predictions)
添加回答
举报
0/150
提交
取消