我正在使用神經(jīng)網(wǎng)絡。當我嘗試將預測與測試集中的實際值進行比較時,我無法做到這一點,因為它不允許我創(chuàng)建包含預測的數(shù)據(jù)幀。所以基本上我無法得到 test_predictions.shape = (10092,) 而不是 o (10092,1)。這個“1”給我?guī)砹怂械穆闊?。有人可以幫忙嗎?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)
根據(jù)神經(jīng)網(wǎng)絡的預測創(chuàng)建數(shù)據(jù)幀系列
慕田峪7331174
2023-10-26 10:42:53