输出的结果总是以keras中的一种热格式显示:
[[ 0. 0. 0. 0. 0. 0. 1. 0]]
[[ 0. 1. 0. 0. 0. 0. 0. 0]]
但我希望每个分类都有一个概率百分比,例如
[[ 0.54 0.80 0.34 0.041]]
我的简单代码如下所示
import numpy as np
from keras.models import load_model
from new_get_data_for_test import load_my_data
try :
X_test = load_my_data()
model = load_model('/home/istiyak/development/pythonProject/my_save_model.h5')
output = model.predict(X_test)
print("After pridiction our output is : ")
print (output)
print(np.argmax(output, axis=1))
except Exception as e :
print ("Some Exception occurs")
先谢谢。