class_docstr: Base class for a forecaster model.
  
  .. note::
  
      If your model depends on an evenly spaced time series, make sure to
  
      1. Call `ForecasterBase.train_pre_process` in `ForecasterBase.train`
      2. Call `ForecasterBase.resample_time_stamps` at the start of
         `ForecasterBase.forecast` to get a set of resampled time stamps, and
         call ``time_series.align(reference=time_stamps)`` to align the forecast
         with the original time stamps.
class_docstr_tok: ["Base","class","for","a","forecaster","model",".","..","note",":",":","If","your","model","depends","on","an","evenly","spaced","time","series",",","make","sure","to","1",".","Call","`","ForecasterBase.train_pre_process","`","in","`","ForecasterBase.train","`","2",".","Call","`","ForecasterBase.resample_time_stamps","`","at","the","start","of","`","ForecasterBase.forecast","`","to","get","a","set","of","resampled","time","stamps",",","and","call","``","time_series.align","(","reference=time_stamps",")","``","to","align","the","forecast","with","the","original","time","stamps","."]
code: def resample_time_stamps(
      self,
      time_stamps: Union[int, List[int]],
      time_series_prev: TimeSeries = None,
  ):
      assert (
          self.timedelta is not None
          and self.last_train_time is not None
      ), (
          "train() must be called before you can call forecast(). "
          "If you have already called train(), make sure it sets "
          "self.timedelta and self.last_train_time appropriately."
      )
  
      # Determine timedelta & initial time of forecast
      dt, offset = self.timedelta, self.timedelta_offset
      if (
          time_series_prev is not None
          and not time_series_prev.is_empty()
      ):
          t0 = to_pd_datetime(time_series_prev.tf)
      else:
          t0 = self.last_train_time
  
      # Handle the case where time_stamps is an integer
      if isinstance(time_stamps, (int, float)):
          n = int(time_stamps)
          assert (
              self.max_forecast_steps is None
              or n <= self.max_forecast_steps
          )
          resampled = (
              pd.date_range(start=t0, periods=n + 1, freq=dt) + offset
          )
          resampled = (
              resampled[1:] if resampled[0] == t0 else resampled[:-1]
          )
          time_stamps = to_timestamp(resampled)
  
      elif not self.require_even_sampling:
          resampled = to_pd_datetime(time_stamps)
  
      # Handle the cases where we don't have a max_forecast_steps
      elif self.max_forecast_steps is None:
          tf = to_pd_datetime(time_stamps[-1])
          resampled = (
              pd.date_range(start=t0, end=tf + 2 * dt, freq=dt) + offset
          )
          if resampled[0] == t0:
              resampled = resampled[1:]
          if len(resampled) > 1 and resampled[-2] >= tf:
              resampled = resampled[:-1]
  
      # Handle the case where we do have a max_forecast_steps
      else:
          resampled = (
              pd.date_range(
                  start=t0, periods=self.max_forecast_steps + 1, freq=dt
              )
              + offset
          )
          resampled = (
              resampled[1:] if resampled[0] == t0 else resampled[:-1]
          )
          resampled = resampled[
              : 1 + sum(resampled < to_pd_datetime(time_stamps[-1]))
          ]
  
      tf = resampled[-1]
      assert (
          to_pd_datetime(time_stamps[0]) >= t0
          and to_pd_datetime(time_stamps[-1]) <= tf
      ), (
          f"Expected `time_stamps` to be between {t0} and {tf}, but `time_stamps` ranges "
          f"from {to_pd_datetime(time_stamps[0])} to {to_pd_datetime(time_stamps[-1])}"
      )
      return to_timestamp(resampled).tolist()
  
imports: from abc import abstractmethod
  import copy
  import logging
  from typing import List, Optional, Tuple, Union
  import numpy
  import pandas
  from scipy.stats import norm
  from merlion.models.base import Config, ModelBase
  from merlion.plot import Figure
  from merlion.transform.base import TransformBase
  from merlion.transform.factory import TransformFactory
  from merlion.transform.normalize import MeanVarNormalize
  from merlion.utils.time_series import to_pd_datetime, to_timestamp, TimeSeries, AggregationPolicy, MissingValuePolicy
label_desc: Use image node_id 7 for calling the ForecasterBase obj's underlying member method code with example usage: obj.resample_time_stamps(time_stamps, time_series_prev) and returns: to_timestamp