def insert_observation(self, obs: float) -> bool:
        """Insert observation.

        Inserts obs into the data buffer and returns true if it is an "outlier", defined `threshold` times larger than
        the windowed moving average from [T-2*`delay_interval` : T-`delay_interval`].

        This algorithm first moves recent data into an intermediate circular buffer, and then moves data in to the delayed moving average buffer
        once it is old enough to be evicted from the intermediate data. This is to ensure that we take a delayed moving average that doesn't include recent data.

        Args:
            obs (float): Numeric observation for the current timestep.

        Returns:
            bool: Indicator of whether the most recent observation was an outlier.
        """
        assert self.intermediate_data_queue.maxlen is not None, 'expected maxlen defined'

        if len(
            self.intermediate_data_queue,
        ) >= self.intermediate_data_queue.maxlen:
            # move data from intermediate queue to slow moving average queue
            intermediate_obs = self.intermediate_data_queue.popleft()
            self.delayed_moving_average.append(intermediate_obs)

        self.intermediate_data_queue.append(obs)
        delayed_mva = self.get_delayed_mva()
        return delayed_mva is not None and obs > self.threshold * delayed_mva
Insert observation.

        Inserts obs into the data buffer and returns true if it is an "outlier", defined `threshold` times larger than
        the windowed moving average from [T-2*`delay_interval` : T-`delay_interval`].

        This algorithm first moves recent data into an intermediate circular buffer, and then moves data in to the delayed moving average buffer
        once it is old enough to be evicted from the intermediate data. This is to ensure that we take a delayed moving average that doesn't include recent data.

        Args:
            obs (float): Numeric observation for the current timestep.

        Returns:
            bool: Indicator of whether the most recent observation was an outlier.
        
llmfoundry/optim/outlier_detection.py