So I'm trying to make a decision tree and my target is array [0, 1] (binary 'NO' or 'YES') and my input training_set is three dimensional array with first elements all 'NO' examples (10) and with 35 features each and same with 'Yes'. but I keep getting this error.
file1 = open(file1.txt) # examples of 'No' class
file2 = open(file2.txt) # examples of 'Yes' class
x = vectorizer.fit_transform(file1)
y = vectorizer.fit_transform(file2)
x_array = x.toarray()
y_array = y.toarray()
x_train, x_test, y_train, y_test = train_test_split(x_array, y_array,
test_size=0.2)
target = [0, 1] # 0 encoded as 'No' and 1 as 'Yes
train = [x_train, y_train]
decisiontree = DecisionTreeClassifier(random_state=0, max_depth=5)
decisiontree = decisiontree.fit(train, target)
Thanks for help.
Edit: I am loading data from a txt file and it is text data, I have tried printing some part of array and here it is
[[0 0 0 ... 0 0 0]
[0 0 0 ... 0 0 0]
[0 0 0 ... 0 0 0]
[0 0 0 ... 0 0 0]]