Python 模型.预测回报值
我在imdb数据集中处理评论,当我想使用model.predict方法在tensorflow中预测用户给定输入的结果时,它给出了一个数组。如何解释该数组的结果Python 模型.预测回报值,python,tensorflow,keras,deep-learning,Python,Tensorflow,Keras,Deep Learning,我在imdb数据集中处理评论,当我想使用model.predict方法在tensorflow中预测用户给定输入的结果时,它给出了一个数组。如何解释该数组的结果 string = str(input()) new_string = token.texts_to_sequences(string) padded_new_string = pad_sequences(new_string,maxlen = 120, truncating = 'post') print(model.predict(pa
string = str(input())
new_string = token.texts_to_sequences(string)
padded_new_string = pad_sequences(new_string,maxlen = 120, truncating = 'post')
print(model.predict(padded_new_string))
我还使用了使用sigmoid的二进制分类
model = tf.keras.Sequential([
tf.keras.layers.Embedding(10000,16,input_length = 120),
tf.keras.layers.Flatten(),
tf.keras.layers.Dense(12,activation = 'relu'),
tf.keras.layers.Dense(6,activation = 'relu'),
tf.keras.layers.Dense(1,activation = 'sigmoid')
])
如果我没有弄错
模型,任何帮助都会很有帮助。predict
为y\u测试的每个相应预测返回numpy
数组。要解释这些值,可以使用evaluate
方法找到模型的准确性
score = model.evaluate(x_test, y_test, verbose=0)
print('Test loss:', score[0])
print('Test accuracy:', score[1])
数组中的其他值呢?他们还必须告诉你一些关于模型的事情。也许你应该看看事实,因为我不能测试你的代码,所以我不能准确地说出你的预测结果。我认为您应该查看您的y_测试
和y_pred
结果,以获得有意义的解释。