After importing libraries in python, I made a simple neural network,
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.25, random_state=42)
model_nnr = MLPRegressor(
hidden_layer_sizes = (30,30,30,30,30),
activation = 'logistic',
random_state = 0
).fit(X_train, y_train)
pred_nnr = model_nnr.predict(X_test)
print('r2_score:',r2_score(X_test, pred_nnr))
print('Mean Squared Error:',mean_squared_error(X_test, pred_nnr))
But I faced the following error,
ValueError: y_true and y_pred have different number of output (9!=1)
Can you please help me to fix it? I have 9 input column and 1 output. I searched for the error and found this post,
You need to change the number of neurons in the output layer to 1 or add a new output layer which has only 1 neuron.
But still couldn't find out how to fix my issue.