0

This is the code:

import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.neighbors import KNeighborsClassifier
from joblib import dump, load
from sklearn.preprocessing import StandardScaler

scaler = StandardScaler()

X = pd.read_csv("C:\\Users\\rafae\\OneDrive\\Documentos\\SOAM\\KSPasswordData.csv")
y = X.pop('subject').values
X_train = scaler.fit(X, y)

y_test = scaler.transform(X, y)

X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2)

scaler.transform(X_train)

clf.fit(X_train)
score = clf.score(X_test, y_test)

print(score)

dump(clf, 'exemplo.jlb')

This is the error:

ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
rpanai
  • 12,515
  • 2
  • 42
  • 64
  • Hi and welcome on SO. It will be great if you can have a look at [ask] and then try to produce a [mcve]. – rpanai Oct 06 '21 at 02:13
  • Does this answer your question? [Truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all()](https://stackoverflow.com/questions/36921951/truth-value-of-a-series-is-ambiguous-use-a-empty-a-bool-a-item-a-any-o) – rpanai Oct 06 '21 at 02:18
  • no, don't answer my question – Rafael Henrique Lemes Oct 06 '21 at 03:16
  • In any case you're example is not reproducible. Please add a data sample. – rpanai Oct 06 '21 at 09:37

0 Answers0