I am trying to log the threshold dependent accuracy values for a ML model stored in a dict object to Tensorboard with the add_scalar method. However, it results in only adding the very last data point to the graph.
The dict basically looks as such:
eval_metrics['accuracy'] = {0.2: 0.375,
0.4: 0.8,
0.6: 0.75,
0.8: 0.35}
My for-loop looks like this:
for key in eval_metrics['accuracy']:
writer.add_scalar('acc', eval_metrics['accuracy'][key], key)
However, only the last of the four key-value pairs gets registered and the resulting scalar thus only contains a single data point. Does anyone know why that is or if there is a way around?
I already tried with different data types for the global_step
value or introducing a new variable replacing the key
variable.
add_scalars
instead ofadd_scalar
is a more suitable function for your need.