How to display the average number of times in a row on a tensocard

Is there a way to display the average of several different runs on a tensor flow? I can see them only on one graph (sending a path for different runs), but I want to see their average value on the graph

+5
source share
3 answers

Please follow issue 376 to see progress on this. This is an active feature request with some progress last month, but there is currently no way to do what you want. Nonetheless.

+2
source

As mentioned by @dga, this is not yet implemented. Here is the code that EventAccumulator uses to combine the total values โ€‹โ€‹of the scalar tensor flow. This can be expanded to accommodate other types of summary data.

 import os from collections import defaultdict import numpy as np import tensorflow as tf from tensorboard.backend.event_processing.event_accumulator import EventAccumulator def tabulate_events(dpath): summary_iterators = [EventAccumulator(os.path.join(dpath, dname)).Reload() for dname in os.listdir(dpath)] tags = summary_iterators[0].Tags()['scalars'] for it in summary_iterators: assert it.Tags()['scalars'] == tags out = defaultdict(list) for tag in tags: for events in zip(*[acc.Scalars(tag) for acc in summary_iterators]): assert len(set(e.step for e in events)) == 1 out[tag].append([e.value for e in events]) return out def write_combined_events(dpath, d_combined, dname='combined'): fpath = os.path.join(dpath, dname) writer = tf.summary.FileWriter(fpath) tags, values = zip(*d_combined.items()) timestep_mean = np.array(values).mean(axis=-1) for tag, means in zip(tags, timestep_mean): for i, mean in enumerate(means): summary = tf.Summary(value=[tf.Summary.Value(tag=tag, simple_value=mean)]) writer.add_summary(summary, global_step=i) writer.flush() dpath = '/path/to/root/directory' d = tabulate_events(dpath) write_combined_events(dpath, d) 

This solution involves a directory structure such as:

 dpath โ”œโ”€โ”€ 1 โ”‚  โ””โ”€โ”€ events.out.tfevents.1518552132.Alexs-MacBook-Pro-2.local โ”œโ”€โ”€ 11 โ”‚  โ””โ”€โ”€ events.out.tfevents.1518552180.Alexs-MacBook-Pro-2.local โ”œโ”€โ”€ 21 โ”‚  โ””โ”€โ”€ events.out.tfevents.1518552224.Alexs-MacBook-Pro-2.local โ”œโ”€โ”€ 31 โ”‚  โ””โ”€โ”€ events.out.tfevents.1518552264.Alexs-MacBook-Pro-2.local โ””โ”€โ”€ 41  โ””โ”€โ”€ events.out.tfevents.1518552304.Alexs-MacBook-Pro-2.local 
+1
source

Since there is no built-in functionality for this yet, I released a tool for this:

https://github.com/Spenhouet/tensorboard-aggregator

This tool can aggregate several runs of the tensor board according to their maximum, minimum, average, median and standard deviation. Aggregates are either saved in new tensor board resumes, or as .csv files.

0
source

Source: https://habr.com/ru/post/1266011/


All Articles