vak.common.tensorboard.events2df#

vak.common.tensorboard.events2df(events_path: str | Path, size_guidance: dict | None = None, drop_wall_time: bool = True) DataFrame[source]#

Convert tensorboard events file to pandas.DataFrame

Events files are created by SummaryWriter from PyTorch or Tensorflow.

Parameters:
  • events_path (str, pathlib.Path) – Path to either a log directory or a specific events file saved by a SummaryWriter in a log directory. By default, vak saves logs in a directory with the model name inside a results directory generated at the start of training.

  • size_guidance (dict) – Argument passed to the EventAccumlator class from tensorboard that is used to load the events file. Information on how much data the EventAccumulator should store in memory. Dict that maps a tagType string to an integer representing the number of items to keep per tag for items of that tagType. If the size is 0, all events are stored. Default is None, in which case vak.tensorboard.DEFAULT_SIZE_GUIDANCE is used. For more information see https://github.com/tensorflow/tensorboard/blob/master/tensorboard/backend/event_processing/event_accumulator.py

  • drop_wall_time (bool) – If True, drop wall times logged in events file. Default is True.

Returns:

df – With index β€˜step’ and all Scalars from the events file

Return type:

pandas.Dataframe

Examples

>>> events_path = 'tweetynet/results_210322_103904/train_dur_6s/replicate_2/TweetyNet/'
>>> events_df = vak.tensorboard.events2df(events_path)
>>> events_df
          loss/train  avg_acc/val  avg_levenshtein/val  avg_character_error_rate/val  avg_loss/val
step
0       2.479142          NaN                  NaN                         NaN           NaN
1       2.458833          NaN                  NaN                         NaN           NaN
2       2.441571          NaN                  NaN                         NaN           NaN
3       2.402737          NaN                  NaN                         NaN           NaN
4       2.404369          NaN                  NaN                         NaN           NaN
...          ...          ...                  ...                         ...           ...
996     0.171681          NaN                  NaN                         NaN           NaN
997     0.100202          NaN                  NaN                         NaN           NaN
998     0.073055          NaN                  NaN                         NaN           NaN
999     0.031479          NaN                  NaN                         NaN           NaN
1000         NaN     0.902475                 42.0                    0.880533      0.310385

[1001 rows x 5 columns]