虽然我在使用StandardScaler
中的MinMaxScaler
解决问题时使用MLPRegressor
或sklearn
预处理我的数据,但预测值在训练集中有很多负数有所有真正的正面价值观。数据在这里:
https://drive.google.com/open?id=1JF_EpyiMF5WzKZOt6d0iA2174eAheaTW
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import MinMaxScaler
from sklearn.neural_network import MLPRegressor
x_train, x_test, y_train, y_test = train_test_split(x,y)
min_max_scaler = preprocessing.MinMaxScaler()
x_train = min_max_scaler.fit_transform(x_train)
x_test = min_max_scaler.transform(x_test)
mlp = MLPRegressor(activation='logistic' , solver='sgd' ,verbose=10, hidden_layer_sizes=(10,10), max_iter=1000)
mlp.fit(x_train, y_train)
print("Training set score :%f" % mlp.score(x_train, y_train))
print("Test score :%f" % mlp.score(x_test, y_test))
predictions = mlp.predict(x_test)
有什么建议问题在哪里?