Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/319.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 模型.预测回报值_Python_Tensorflow_Keras_Deep Learning - Fatal编程技术网

Python 模型.预测回报值

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

我在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(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
结果,以获得有意义的解释。