未知的标签类型scikitlearn

时间:2017-02-25 17:59:38

标签: python scikit-learn

我试图制作股票价格分类器,但我总是得到同样的错误:

import pandas as pd
from sklearn.neural_network import MLPClassifier
import numpy as np
data = pd.read_csv("aapl.csv")
X_data = np.array(data["Open"])
X = []
y = np.array(data["Close"])
for i in range(0, len(X_data)):
    X.append([[X_data[i]]])
X = np.array(X)

X = X.reshape(len(X), 1)
clf = MLPClassifier(solver='lbfgs', alpha=1e-5, hidden_layer_sizes=(20, ),        random_state=1)
clf.fit(X , y)
print("Training set score: %f" % clf.score(X, y))
#print("Test set score: %f" % clf.score(X, y))

错误讯息:

ValueError: Unknown label type: (array([ 136.66, 136.53, 137.11, ..., 100.75, 100.53, 96.69]),)

0 个答案:

没有答案