              if tabname in existing:
                  continue
  
              display_keys = [key for key in loss_keys if key.startswith(loss_key)]
              data = Calculations(session=get_config().session,
                                  display="loss",
                                  loss_keys=display_keys,
                                  selections=["raw", "smoothed"],
                                  smooth_amount=get_config().tk_vars["smoothgraph"].get())
              self.add_child(tabname, data)
 
</s> remove                                 smooth_amount=get_config().tk_vars["smoothgraph"].get())
 </s> add                                 smooth_amount=self.vars["smoothgraph"].get()) </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     def smooth_amount_callback(self, *args):
 </s> add     def _smooth_amount_callback(self, *args): </s> remove             method = getattr(self, "calc_{}".format(selection))
            raw_keys = [key for key in self.stats.keys() if key.startswith("raw_")]
 </s> add             method = getattr(self, "_calc_{}".format(selection))
            raw_keys = [key for key in self._stats if key.startswith("raw_")]
            data = Calculations(session_id=Session.session_ids[-1],
              if tabname in existing:
                  continue
  
              display_keys = [key for key in loss_keys if key.startswith(loss_key)]
            data = Calculations(session_id=Session.session_ids[-1],
                                  display="loss",
                                  loss_keys=display_keys,
                                  selections=["raw", "smoothed"],
                                  smooth_amount=get_config().tk_vars["smoothgraph"].get())
              self.add_child(tabname, data)
keep keep keep keep replace 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/display_command.py