          session = get_config().session
          if not session.initialized:
              logger.debug("Training not running")
              return
          if session.logging_disabled:
              logger.trace("Logging disabled. Not triggering analysis update")
              return
          msg = "Currently running training session"
          self._session = session
          # Reload the state file to get approx currently training iterations
 
</s> remove         msg = "Currently running training session"
        self._session = session
        # Reload the state file to get approx currently training iterations
        self._session.load_state_file()
        self._set_session_summary(msg)
 </s> add         self._clear_session()
        self._set_session_summary("Currently running training session") </s> remove         self._clear_session()
        session = get_config().session
        if not session.initialized:
 </s> add         if not Session.is_training: </s> remove         session = get_config().session
        smooth_amount_var = get_config().tk_vars["smoothgraph"]
        if session.initialized and session.logging_disabled:
 </s> add         if Session.is_training and Session.logging_disabled: </s> remove             if self.trace_var is not None:
                smooth_amount_var.trace_vdelete("w", self.trace_var)
                self.trace_var = None
        elif session.initialized:
 </s> add             self._clear_trace_variables()
        elif Session.is_training and self.display_item is None: </s> remove         if self._session is None:
 </s> add         if not Session.is_loaded:
        if Session.logging_disabled:
          session = get_config().session
          if not session.initialized:
              logger.debug("Training not running")
              return
        if Session.logging_disabled:
              logger.trace("Logging disabled. Not triggering analysis update")
              return
          msg = "Currently running training session"
          self._session = session
          # Reload the state file to get approx currently training iterations
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_analysis.py