0
我是新來Keras,這是我的NN:Keras - predict_proba不加起來1?
model = Sequential()
model.add(Dense(12, activation="relu", input_dim=12, kernel_initializer="normal"))
model.add(Dense(3, activation="sigmoid", kernel_initializer="normal"))
model.compile(loss='categorical_crossentropy', optimizer='adam', metrics=['accuracy'])
我有3個輸出:高,中,低。
當我試圖用predict
功能,我得到正確的類:
array(['medium', 'low', 'medium', ..., 'low', 'medium', 'low'], dtype=object)
然而,當我試圖predict_proba
功能,我會得到不加起來1的概率?
array([[ 4.93983855e-04, 2.28181913e-01, 9.70774710e-01],
[ 3.14530940e-03, 9.60477769e-01, 3.79752717e-04],
[ 1.40661141e-03, 5.70683666e-02, 9.96348858e-01],
...,
[ 1.29012510e-01, 7.08254218e-01, 2.44960701e-03],
[ 1.69786233e-02, 4.71719205e-02, 9.90665674e-01],
[ 1.28657368e-04, 9.89430904e-01, 9.04915680e-04]], dtype=float32)
的第一行是4.93983855e-04 + 2.28181913e-01 + 9.70774710e-01,總和爲1.199450606855,這是大於1
我認爲第一行是指:的概率第一列(4.93983855e-04)中等?
謝謝,有用! – user1157751