              The original statistics formatted for display
          """
          logger.debug("Formatting stats")
          for summary in compiled_stats:
              hrs, mins, secs = self._convert_time(summary["elapsed"])
              stats = dict()
              for key in summary:
                  if key not in ("start", "end", "elapsed", "rate"):
 
</s> remove             hrs, mins, secs = convert_time(summary["elapsed"])
            summary["start"] = time.strftime("%x %X", time.localtime(summary["start"]))
            summary["end"] = time.strftime("%x %X", time.localtime(summary["end"]))
            summary["elapsed"] = "{}:{}:{}".format(hrs, mins, secs)
            summary["rate"] = "{0:.1f}".format(summary["rate"])
        return compiled_stats
 </s> add             hrs, mins, secs = self._convert_time(summary["elapsed"])
            stats = dict()
            for key in summary:
                if key not in ("start", "end", "elapsed", "rate"):
                    stats[key] = summary[key]
                    continue
                stats["start"] = time.strftime("%x %X", time.localtime(summary["start"]))
                stats["end"] = time.strftime("%x %X", time.localtime(summary["end"]))
                stats["elapsed"] = "{}:{}:{}".format(hrs, mins, secs)
                stats["rate"] = "{0:.1f}".format(summary["rate"])
            retval.append(stats)
        return retval

    @classmethod
    def _convert_time(cls, timestamp):
        """ Convert time stamp to total hours, minutes and seconds.

        Parameters
        ----------
        timestamp: float
            The Unix timestamp to be converted

        Returns
        -------
        tuple
            (`hours`, `minutes`, `seconds`) as ints
        """
        hrs = int(timestamp // 3600)
        if hrs < 10:
            hrs = "{0:02d}".format(hrs)
        mins = "{0:02d}".format((int(timestamp % 3600) // 60))
        secs = "{0:02d}".format((int(timestamp % 3600) % 60))
        return hrs, mins, secs </s> remove     @staticmethod
    def format_stats(compiled_stats):
        """ Format for display """
 </s> add     def _format_stats(self, compiled_stats):
        """ Format for the incoming list of statistics for display.

        Parameters
        ----------
        compiled_stats: list
            List of summary statistics dictionaries to be formatted for display

        Returns
        -------
        list
            The original statistics formatted for display
        """ </s> remove     @property
    def total_loss(self):
        """ dict: The collated loss for all sessions for each loss key """
        loss_dict = dict()
        all_loss = self.tb_logs.get_loss()
        for key in sorted(all_loss):
            for loss_key, loss in all_loss[key].items():
                loss_dict.setdefault(loss_key, []).extend(loss)
        return loss_dict
 </s> add             self._time_stats = {
                sess_id: dict(start_time=np.min(timestamps) if np.any(timestamps) else 0,
                              end_time=np.max(timestamps) if np.any(timestamps) else 0,
                              iterations=timestamps.shape[0] if np.any(timestamps) else 0)
                for sess_id, timestamps in self._session.get_timestamps(None).items()} </s> remove         loss_keys = [key for key in self.display_item.loss_keys if key != "total"]
 </s> add         loss_keys = [key
                     for key in self.display_item.get_loss_keys(Session.session_ids[-1])
                     if key != "total"] </s> remove         raw = dict()
 </s> add         self.stats.clear()
        retval = []
              The original statistics formatted for display
          """
          logger.debug("Formatting stats")
        retval = []
          for summary in compiled_stats:
              hrs, mins, secs = self._convert_time(summary["elapsed"])
              stats = dict()
              for key in summary:
                  if key not in ("start", "end", "elapsed", "rate"):
keep keep add keep keep keep keep keep
 GUI - Stats optimization (#1067)

* Faster stat loading + caching

* Compress data in cache

* Optimize some calculations

* Vectorize smoothing

* stats.Calculations optimized

* Load latest training data from live iterator

* Add options to training graph 
lib/gui/stats.py