class_docstr: Base class for a forecast-based anomaly detector.
docstr: :param time_series: the time series over whose timestamps we wish to make a forecast. Exactly one of
      ``time_series`` or ``time_stamps`` should be provided.
  :param time_stamps: Either a ``list`` of timestamps we wish to forecast for, or the number of steps (``int``)
      we wish to forecast for. Exactly one of ``time_series`` or ``time_stamps`` should be provided.
  :param time_series_prev: a time series immediately preceding ``time_series``. If given, we use it to initialize
      the forecaster's state. Otherwise, we assume that ``time_series`` immediately follows the training data.
  :param exog_data: A time series of exogenous variables. Exogenous variables are known a priori, and they are
      independent of the variable being forecasted. ``exog_data`` must include data for all of ``time_stamps``;
      if ``time_series_prev`` is given, it must include data for all of ``time_series_prev.time_stamps`` as well.
      Optional. Only supported for models which inherit from `ForecasterExogBase`.
  :param plot_anomaly: Whether to plot the model's predicted anomaly scores.
  :param filter_scores: whether to filter the anomaly scores by the post-rule before plotting them.
  :param plot_forecast: Whether to plot the model's forecasted values.
  :param plot_forecast_uncertainty: whether to plot uncertainty estimates (the inter-quartile range) for forecast
      values. Not supported for all models.
  :param plot_time_series_prev: whether to plot ``time_series_prev`` (and the model's fit for it). Only used if
      ``time_series_prev`` is given.
  :return: a `Figure` of the model's anomaly score predictions and/or forecast.
docstr_tok: [":","param","time_series",":","the","time","series","over","whose","timestamps","we","wish","to","make","a","forecast",".","Exactly","one","of","``","time_series","``","or","``","time_stamps","``","should","be","provided",".",":","param","time_stamps",":","Either","a","``","list","``","of","timestamps","we","wish","to","forecast","for",",","or","the","number","of","steps","(","``","int","``",")","we","wish","to","forecast","for",".","Exactly","one","of","``","time_series","``","or","``","time_stamps","``","should","be","provided",".",":","param","time_series_prev",":","a","time","series","immediately","preceding","``","time_series","``",".","If","given",",","we","use","it","to","initialize","the","forecaster","'s","state",".","Otherwise",",","we","assume","that","``","time_series","``","immediately","follows","the","training","data",".",":","param","exog_data",":","A","time","series","of","exogenous","variables",".","Exogenous","variables","are","known","a","priori",",","and","they","are","independent","of","the","variable","being","forecasted",".","``","exog_data","``","must","include","data","for","all","of","``","time_stamps","``",";","if","``","time_series_prev","``","is","given",",","it","must","include","data","for","all","of","``","time_series_prev.time_stamps","``","as","well",".","Optional",".","Only","supported","for","models","which","inherit","from","`","ForecasterExogBase","`",".",":","param","plot_anomaly",":","Whether","to","plot","the","model","'s","predicted","anomaly","scores",".",":","param","filter_scores",":","whether","to","filter","the","anomaly","scores","by","the","post-rule","before","plotting","them",".",":","param","plot_forecast",":","Whether","to","plot","the","model","'s","forecasted","values",".",":","param","plot_forecast_uncertainty",":","whether","to","plot","uncertainty","estimates","(","the","inter-quartile","range",")","for","forecast","values",".","Not","supported","for","all","models",".",":","param","plot_time_series_prev",":","whether","to","plot","``","time_series_prev","``","(","and","the","model","'s","fit","for","it",")",".","Only","used","if","``","time_series_prev","``","is","given",".",":","return",":","a","`","Figure","`","of","the","model","'s","anomaly","score","predictions","and\/or","forecast","."]
code: def get_figure(
      self,
      *,
      time_series: TimeSeries = None,
      time_stamps: List[int] = None,
      time_series_prev: TimeSeries = None,
      exog_data: TimeSeries = None,
      plot_anomaly=True,
      filter_scores=True,
      plot_forecast=False,
      plot_forecast_uncertainty=False,
      plot_time_series_prev=False,
  ) -> Figure:
      """
      :param time_series: the time series over whose timestamps we wish to make a forecast. Exactly one of
          ``time_series`` or ``time_stamps`` should be provided.
      :param time_stamps: Either a ``list`` of timestamps we wish to forecast for, or the number of steps (``int``)
          we wish to forecast for. Exactly one of ``time_series`` or ``time_stamps`` should be provided.
      :param time_series_prev: a time series immediately preceding ``time_series``. If given, we use it to initialize
          the forecaster's state. Otherwise, we assume that ``time_series`` immediately follows the training data.
      :param exog_data: A time series of exogenous variables. Exogenous variables are known a priori, and they are
          independent of the variable being forecasted. ``exog_data`` must include data for all of ``time_stamps``;
          if ``time_series_prev`` is given, it must include data for all of ``time_series_prev.time_stamps`` as well.
          Optional. Only supported for models which inherit from `ForecasterExogBase`.
      :param plot_anomaly: Whether to plot the model's predicted anomaly scores.
      :param filter_scores: whether to filter the anomaly scores by the post-rule before plotting them.
      :param plot_forecast: Whether to plot the model's forecasted values.
      :param plot_forecast_uncertainty: whether to plot uncertainty estimates (the inter-quartile range) for forecast
          values. Not supported for all models.
      :param plot_time_series_prev: whether to plot ``time_series_prev`` (and the model's fit for it). Only used if
          ``time_series_prev`` is given.
      :return: a `Figure` of the model's anomaly score predictions and/or forecast.
      """
      assert not (
          time_series is None and time_stamps is None
      ), "Must provide at least one of time_series or time_stamps"
      fig = None
      plot_forecast = (
          plot_forecast or plot_forecast_uncertainty or not plot_anomaly
      )
      if plot_forecast or time_series is None:
          fig = ForecasterBase.get_figure(
              self,
              time_series=time_series,
              time_stamps=time_stamps,
              exog_data=exog_data,
              time_series_prev=time_series_prev,
              plot_forecast_uncertainty=plot_forecast_uncertainty,
              plot_time_series_prev=plot_time_series_prev,
          )
      if time_series is None or not plot_anomaly:
          return fig
      return DetectorBase.get_figure(
          self,
          time_series=time_series,
          time_series_prev=time_series_prev,
          exog_data=exog_data,
          plot_time_series_prev=plot_time_series_prev,
          filter_scores=filter_scores,
          fig=fig,
      )
  
imports: import copy
  import logging
  from typing import List, Optional, Tuple, Union
  import numpy
  import pandas
  from merlion.models.anomaly.base import DetectorBase
  from merlion.models.forecast.base import ForecasterBase
  from merlion.plot import Figure
  from merlion.utils import TimeSeries
  from merlion.utils.misc import AutodocABCMeta
label_desc: Use image node_id 8 for calling the ForecastingDetectorBase obj's underlying member method code with example usage: obj.get_figure() and returns: DetectorBase, fig