docstr: Core process for fitting a model within a forecaster
docstr_tok: ["Core","process","for","fitting","a","model","within","a","forecaster"]
code: def fit(self, df, **kwargs):
      """Core process for fitting a model within a forecaster"""
      estimator = self.estimator
      model_name = self._model.get_model_name()
      df = df.copy()
  
      # default set and validation of input data frame
      self._validate_training_df(df)
      # extract standard training metadata
      self._set_training_meta(df)
      # customize module
      self._model.set_dynamic_attributes(
          df=df, training_meta=self.get_training_meta()
      )
      # based on the model and df, set training input
      self.set_training_data_input()
      # if model provide initial values, set it
      self._model.set_init_values()
  
      # estimator inputs
      data_input = self.get_training_data_input()
      init_values = self._model.get_init_values()
      model_param_names = self._model.get_model_param_names()
  
      # note that estimator will search for the .stan, .pyro model file based on the
      # estimator type and model_name provided
      _posterior_samples, training_metrics = estimator.fit(
          model_name=model_name,
          model_param_names=model_param_names,
          data_input=data_input,
          fitter=self._model.get_fitter(),
          init_values=init_values,
          **kwargs,
      )
      self._posterior_samples = _posterior_samples
      self._training_metrics = training_metrics
  
imports: from copy import deepcopy
  import numpy
  import pandas
  import warnings
  from enum import Enum
  from typing import Dict, Any
  from ..exceptions import ForecasterException, AbstractMethodException, IllegalArgument
  from ..utils.general import is_ordered_datetime, is_even_gap_datetime
  from ..template.model_template import ModelTemplate
  from ..estimators.stan_estimator import StanEstimatorMCMC
  from ..constants.constants import TrainingMetaKeys, PredictionMetaKeys
label_desc: Use image node_id 3 for calling the Forecaster obj's underlying member method code with example usage: obj.fit(df) without return types