class_docstr: Base class for an anomaly detection model.
class_docstr_tok: ["Base","class","for","an","anomaly","detection","model","."]
docstr: Trains the anomaly detector (unsupervised) and its post-rule (supervised, if labels are given) on train data.
  
  :param train_data: a `TimeSeries` of metric values to train the model.
  :param train_config: Additional training configs, if needed. Only required for some models.
  :param anomaly_labels: a `TimeSeries` indicating which timestamps are anomalous. Optional.
  :param post_rule_train_config: The config to use for training the model's post-rule. The model's default
      post-rule train config is used if none is supplied here.
  
  :return: A `TimeSeries` of the model's anomaly scores on the training data.
docstr_tok: ["Trains","the","anomaly","detector","(","unsupervised",")","and","its","post-rule","(","supervised",",","if","labels","are","given",")","on","train","data",".",":","param","train_data",":","a","`","TimeSeries","`","of","metric","values","to","train","the","model",".",":","param","train_config",":","Additional","training","configs",",","if","needed",".","Only","required","for","some","models",".",":","param","anomaly_labels",":","a","`","TimeSeries","`","indicating","which","timestamps","are","anomalous",".","Optional",".",":","param","post_rule_train_config",":","The","config","to","use","for","training","the","model","'s","post-rule",".","The","model","'s","default","post-rule","train","config","is","used","if","none","is","supplied","here",".",":","return",":","A","`","TimeSeries","`","of","the","model","'s","anomaly","scores","on","the","training","data","."]
code: def train(
      self,
      train_data: TimeSeries,
      train_config=None,
      anomaly_labels: TimeSeries = None,
      post_rule_train_config=None,
  ) -> TimeSeries:
      """
      Trains the anomaly detector (unsupervised) and its post-rule (supervised, if labels are given) on train data.
  
      :param train_data: a `TimeSeries` of metric values to train the model.
      :param train_config: Additional training configs, if needed. Only required for some models.
      :param anomaly_labels: a `TimeSeries` indicating which timestamps are anomalous. Optional.
      :param post_rule_train_config: The config to use for training the model's post-rule. The model's default
          post-rule train config is used if none is supplied here.
  
      :return: A `TimeSeries` of the model's anomaly scores on the training data.
      """
      if train_config is None:
          train_config = copy.deepcopy(self._default_train_config)
      train_data = self.train_pre_process(train_data)
      train_data = (
          train_data.to_pd() if self._pandas_train else train_data
      )
      train_result = call_with_accepted_kwargs(  # For ensembles
          self._train,
          train_data=train_data,
          train_config=train_config,
          anomaly_labels=anomaly_labels,
      )
      return self.train_post_process(
          train_result=train_result,
          anomaly_labels=anomaly_labels,
          post_rule_train_config=post_rule_train_config,
      )
  
imports: from abc import abstractmethod
  import copy
  import inspect
  import logging
  from typing import Any, Dict, List, Union
  import pandas
  from scipy.stats import norm
  from merlion.models.base import Config, ModelBase, MultipleTimeseriesModelMixin
  from merlion.plot import Figure, MTSFigure
  from merlion.post_process.calibrate import AnomScoreCalibrator
  from merlion.post_process.factory import PostRuleFactory
  from merlion.post_process.sequence import PostRuleSequence
  from merlion.post_process.threshold import AggregateAlarms, Threshold
  from merlion.utils import TimeSeries, UnivariateTimeSeries
  from merlion.utils.misc import call_with_accepted_kwargs
label_desc: Use image node_id 7 for calling the DetectorBase obj's underlying member method code with example usage: obj.train(train_data, train_config, anomaly_labels, post_rule_train_config) and returns: self