Я пытаюсь оценить оценку точности, отчет о классификации, матрицу путаницы, используя tflearn, но я получил эту ошибку Ожидаемый тип массива (массив или нестроковая последовательность), получил tf.Tensor ArgMax_31: 0 'shape = (3809,) dtype = int64>
# Encoding Target Value
# convert target value from string to integer
le=LabelEncoder()
Y_le=le.fit_transform(Y)
Y_le_oh=to_categorical(Y_le, nb_classes=2)
# Create the model
tf.reset_default_graph() #solve problem list out of index
net =input_data(shape=[None, 35], name='input')
net=tflearn.embedding(net, max_features, output_dim=32)
conv1=conv_1d(net, 100, 3, padding='valid', activation='relu')
conv1=max_pool_1d(conv1,2)
conv1=flatten(conv1)
conv1=fully_connected(conv1, 256, activation='relu')
conv1=fully_connected(conv1, 2, activation='softmax')
conv1 = regression(conv1, optimizer='adam', learning_rate=0.001,
loss='categorical_crossentropy', name='target')
history=model.fit(X_train, Y_train, n_epoch=3, validation_set=(X_Val, Y_Val),show_metric=True, batch_size=32)
scores = model.evaluate(X_test, Y_test)
print("Accuracy: %.2f%%" % (scores[-1]*100))
def tflearn_evaluate():
# predict class with test set
Y_predict =model.predict_label(X_test)
#Y_predict=tf.nn.softmax(Y_predict)
print('Accuracy:\t{:0.1f}%'.format(accuracy_score(tf.argmax(Y_test, axis=1),Y_predict)*100))
#classification report
print('\n')
print(classification_report(Y_test, Y_predict))
#confusion matrix
confmat = tf.confusion_matrix(Y_test, Y_predict,num_classes=None,dtype=tf.int32,name=None,weights=None)
fig, ax = plt.subplots(figsize=(4, 4))
ax.matshow(confmat, cmap=plt.cm.Blues, alpha=0.3)
for i in range(confmat.shape[0]):
for j in range(confmat.shape[1]):
ax.text(x=j, y=i, s=confmat[i, j], va='center', ha='center')
plt.xlabel('Predicted label')
plt.ylabel('True label')
plt.tight_layout()