找到样本数不一致的输入变量:[1,720000]

时间:2017-05-10 16:52:53

标签: python neural-network sentiment-analysis

所以我使用csv文件来收集我的数据,并将其拆分为训练和测试数据。虽然当我来使用MLPCkassifier()。fit()时,它告诉我X和Y的大小不同,当我知道它们都是720,000时。任何想法,这是我的论文,我真的卡住了!

请在下面找到代码段

sentiment = []
tweet = []
with open('WholeDataset.csv', 'r', encoding='ISO-8859-1') as myfile:
    reader = csv.reader(myfile, delimiter=',')
    for val in reader:
        sentiment.append(val[0])
        tweet.append(val[1])

def evaluate_classifier(featx):

    x_train, x_test, y_train, y_test = sklearn.cross_validation.train_test_split(tweet, sentiment, test_size=0.10,random_state=42)


    # using 2 classifiers
    classifier_list = [ 'nn']

    for cl in classifier_list:
        if cl == 'nn':
            classifierName = 'Neural Network'
            classifier = MLPClassifier()
            classifier.fit(x_train, y_train)

请在下面找到错误消息

ValueError: Found input variables with inconsistent numbers of samples: [1, 720000]

0 个答案:

没有答案