What are all metrics than can be used in compiling tf.keras models?

Viewed 756

To compile a tf.keras model one would go:

model.compile(
    optimizer='sgd',#'adam', or what not
    loss='sparse_categorical_crossentropy', 
    metrics=['accuracy','mae']
)

What are the other metrics that can be used as the parameter value for 'metrics'? I fruitlessly tried to look for them in the documentation. I'm looking for the entire list.

Edit: I know one could use explicit form. e.g.

metrics=[tf.keras.metrics.MeanAbsoluteError()] #instead of "mae"

but the short tags are more useful later for for plotting:

lossplot = df.plot(y="mae", title="Loss vs Epochs", legend=False)
lossplot.set(xLabel="Epochs", yLabel="Loss")
1 Answers

From Keras Model training APIs page:

metrics: List of metrics to be evaluated by the model during training and testing. Each of this can be a string (name of a built-in function), function or a tf.keras.metrics.Metric instance.[...]

and from Keras Metrics page:

All built-in metrics may also be passed via their string identifier (in this case, default constructor argument values are used, including a default metric name)

Now you can find the entire list of build-in metrics in the documentation link you found under the section Functions. It's basically the function name as string.

Related