1 label輸入的時候,若是是二分類,一維就能夠,若是是三分類,必須三維測試
必須爲 [1,0,0]、[0,1,0]、[0,1,1]spa
2 對於預測結果class
result_1= model.predict(x_test) # 就是分類,輸出哪一個維度,本項目是三類,就輸出0,1,2, 0表明 [1,0,0],1表明[0,1,0],2表明[0,0,1] result_2 = model.predict_classes(x_test)
注意,好比12條測試語句test
result_1 結果基礎
00 = {ndarray} [0.2377571 0.12362082 0.63862205]
01 = {ndarray} [0.3286156 0.01859419 0.6527902 ]
02 = {ndarray} [0.05248537 0.8776761 0.06983855]
03 = {ndarray} [0.45481557 0.06610067 0.4790837 ]
04 = {ndarray} [0.46586016 0.28993273 0.2442071 ]
05 = {ndarray} [0.09239112 0.44054875 0.46706006]
06 = {ndarray} [0.10662748 0.5958726 0.29749998]
07 = {ndarray} [0.19824359 0.01758298 0.7841734 ]
08 = {ndarray} [0.48175177 0.02743118 0.49081698]
09 = {ndarray} [0.22894093 0.02856255 0.7424965 ]
10 = {ndarray} [0.07185426 0.06959855 0.8585472 ]
11 = {ndarray} [0.02139795 0.89425915 0.08434288]model
result_1 結果項目
<class 'list'>: [2, 2, 1, 2, 0, 2, 1, 2, 2, 2, 2, 1]dict
不難發現,model.predict_classes是分類結果,屬於哪一維度,在result_1的基礎上再算了一遍。di