code: def h5_cost_data(filename, epoch_axis=True):
      """
      Read cost data from hdf5 file. Generate x axis data for each cost line.
  
      Arguments:
          filename (str): Filename with hdf5 cost data
          epoch_axis (bool): whether to render epoch or minibatch as the integer step in the x axis
  
      Returns:
          list of tuples of (name, x data, y data)
      """
      ret = list()
      with h5py.File(filename, "r") as f:
          config, cost, time_markers = [
              f[x] for x in ["config", "cost", "time_markers"]
          ]
          total_epochs = config.attrs["total_epochs"]
          total_minibatches = config.attrs["total_minibatches"]
          minibatch_markers = time_markers["minibatch"]
  
          for name, ydata in cost.items():
              y = ydata[...]
              if ydata.attrs["time_markers"] == "epoch_freq":
                  y_epoch_freq = ydata.attrs["epoch_freq"]
                  assert len(y) == total_epochs // y_epoch_freq
                  x = create_epoch_x(
                      len(y),
                      y_epoch_freq,
                      minibatch_markers,
                      epoch_axis,
                  )
  
              elif ydata.attrs["time_markers"] == "minibatch":
                  assert len(y) == total_minibatches
                  x = create_minibatch_x(
                      total_minibatches, minibatch_markers, epoch_axis
                  )
  
              else:
                  raise TypeError(
                      "Unsupported data format for h5_cost_data"
                  )
  
              ret.append((name, x, y))
  
      return ret
  
file_path: neon/neon/visualizations/data.py
imports: from __future__ import division
  from builtins import str
  import h5py
  import numpy
label_desc: Use image node_id 3 for calling a global function with example usage: h5_cost_data(filename, epoch_axis) and returns: ret