Неправильная форма ввода конвейера - PullRequest
0 голосов
/ 29 марта 2020

Я пытаюсь запустить конвейер, но получаю сообщение об ошибке, указывающее на неправильную форму ввода (153,2). Кто-нибудь знает, как это исправить?

Вот мой код:

  # feature engineering (words to vectors)
  from sklearn.feature_extraction.text import TfidfVectorizer
  # classification algorithms (or classifiers)
  from sklearn.naive_bayes import MultinomialNB
  from sklearn.neighbors import KNeighborsClassifier
  from sklearn.svm import SVC, LinearSVC

   # build a pipeline
    from sklearn.pipeline import Pipeline
    from sklearn.metrics import classification_report, f1_score, 
    accuracy_score, confusion_matrix
    from sklearn.model_selection import StratifiedKFold, cross_val_score, 
    train_test_split, GridSearchCV 
    from sklearn import metrics
    from sklearn.metrics import roc_curve, auc

    #pip install scikit-plot 
    import scikitplot as skplt
    x_train, x_test, y_train, y_test = train_test_split(output_data, 
    output_labels, test_size=0.3, random_state=0)
    len(x_train), len(y_train), len(x_test), len(y_test)

import numpy as np
svm_pipeline = Pipeline([('tfidf', TfidfVectorizer(decode_error ='ignore')), ('clf', SVC(kernel='linear', probability=True))])
svm_pipeline = svm_pipeline.fit(x_train, y_train)
predicted = svm_pipeline.predict(x_test)
np.mean(predicted == y_test)
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...