Skip to content

Instantly share code, notes, and snippets.

@ntakouris
Created July 10, 2020 08:42
Show Gist options
  • Save ntakouris/c2e9bfec58299cb0386b7d2ddd627bac to your computer and use it in GitHub Desktop.
Save ntakouris/c2e9bfec58299cb0386b7d2ddd627bac to your computer and use it in GitHub Desktop.
import tensorflow_model_analysis as tfma
# model.compile(..., metrics=[...]), etc) will be computed
# automatically.
metrics=[
tfma.MetricConfig(class_name='ExampleCount')
],
# To add validation thresholds for metrics saved with the model,
# add them keyed by metric name to the thresholds map.
thresholds = {
"binary_accuracy": tfma.MetricThreshold(
value_threshold=tfma.GenericValueThreshold(
lower_bound={'value': 0.5}),
change_threshold=tfma.GenericChangeThreshold(
direction=tfma.MetricDirection.HIGHER_IS_BETTER,
absolute={'value': -1e-10}))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment