              self.iterations = len(data)
              raw = {"raw_rate": data}
  
          logger.debug("Got Raw Data")
          return raw
  
      def remove_raw(self):
          """ Remove raw values from stats if not requested """
          if "raw" in self.selections:
              return
 
</s> remove     def remove_raw(self):
        """ Remove raw values from stats if not requested """
        if "raw" in self.selections:
 </s> add     @classmethod
    def _flatten_outliers(cls, data):
        """ Remove the outliers from a provided list.

        Removes data more than 1 Standard Deviation from the mean.

        Parameters
        ----------
        data: :class:`numpy.ndarray`
            The data to remove the outliers from

        Returns
        -------
        :class:`numpy.ndarray`
            The data with outliers removed
        """
        logger.debug("Flattening outliers: %s", data.shape)
        mean = np.mean(data)
        limit = np.std(data)
        logger.debug("mean: %s, limit: %s", mean, limit)
        retdata = np.where(abs(data - mean) < limit, data, mean)
        logger.debug("Flattened outliers")
        return retdata

    def _remove_raw(self):
        """ Remove raw values from :attr:`stats` if they are not requested. """
        if "raw" in self._selections: </s> remove             data = self.calc_rate_total() if self.is_totals else self.calc_rate()
            if self.args["flatten_outliers"]:
                data = self.flatten_outliers(data)
            self.iterations = len(data)
            raw = {"raw_rate": data}
 </s> add             data = self._calc_rate_total() if self._is_totals else self._calc_rate()
            if self._args["flatten_outliers"]:
                data = self._flatten_outliers(data)
            self._iterations = data.shape[0]
            self.stats["raw_rate"] = data </s> remove         for key in list(self.stats.keys()):
 </s> add         for key in list(self._stats.keys()): </s> remove         raw = dict()
 </s> add         self.stats.clear() </s> remove         if self.display.lower() == "loss":
            loss_dict = self.session.total_loss if self.is_totals else self.session.loss
 </s> add         if self._display.lower() == "loss":
            loss_dict = Session.get_loss(self._session_id)
              self.iterations = len(data)
              raw = {"raw_rate": data}
  
          logger.debug("Got Raw Data")

  
      def remove_raw(self):
          """ Remove raw values from stats if not requested """
          if "raw" in self.selections:
              return
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/stats.py