While I was constructing a simple Sequential ANN and selecting parameters for the model.compile
method, I observed that Keras.metrics
and Keras.losses
contain capitalized as well as lowercase versions, for example tf.keras.metrics.SparseCategoricalAccuracy
versus tf.keras.metrics.sparse_categorical_accuracy
. I was wondering what the difference is between those versions and which one is more suitable to be used in model.compile
?
tf.keras.metrics.SparseCategoricalAccuracy
is a Class so you get an object and you can pass it over to model.compile
. Since it is an object it can have state between the calls.
However tf.keras.metrics.sparse_categorical_accuracy
is a function and it is stateless. Both perform the same operation but their usage is different.