简体   繁体   中英

Why does Keras Precision metric work on One-Hot-Vectors but their Accuracy metric does not?

This doesn't seem to make sense to me. When I use the keras.metrics.Precision metric it works fine on my multi-class model ( ie on one-hot-vector outputs ), but when I use keras.metrics.Accuracy it does not work ( 0.0 accuracy ), and I need to use a specific variant of it for one-hot-vector outputs: keras.metrics.CategoricalAccuracy .

Why is this? It seems very inconsistent while I don't see a reason an Accuracy metric should require different output label formats than Precision, but maybe I'm overseeing something. Or is this not expected behavior and is there something wrong with my model?

Any insights would be much appreciated!

PS For reference, I'm using the metrics on a Keras.Sequential model (LSTM specifically) with 2-neurons output Dense layer with Softmax activation.

As stated in Accuracy metrics , there are two types of accuracy: Binary Accuracy which "calculates how often predictions match binary labels" and Categorical Accuracy which "calculates how often predictions match one-hot labels". It also states that accuracy is returned as binary accuracy.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM