docstr: standard checks that historical forecasts work with direct likelihood parameter predictions
  with regression and torch models.
code: def test_predict_likelihood_parameters(self, model_type):
      """standard checks that historical forecasts work with direct likelihood parameter predictions
      with regression and torch models."""
  
      model = self.create_model(1, False, model_type=model_type)
      # skip torch models if not installed
      if model is None:
          return
      # model doesn't use likelihood
      with pytest.raises(ValueError):
          model.historical_forecasts(
              self.ts_pass_train,
              predict_likelihood_parameters=True,
          )
  
      model = self.create_model(1, model_type=model_type)
      # forecast_horizon > output_chunk_length doesn't work
      with pytest.raises(ValueError):
          model.historical_forecasts(
              self.ts_pass_train,
              predict_likelihood_parameters=True,
              forecast_horizon=2,
          )
  
      model = self.create_model(1, model_type=model_type)
      # num_samples != 1 doesn't work
      with pytest.raises(ValueError):
          model.historical_forecasts(
              self.ts_pass_train,
              predict_likelihood_parameters=True,
              forecast_horizon=1,
              num_samples=2,
          )
  
      n = 3
      target_name = self.ts_pass_train.components[0]
      qs_expected = ["q0.05", "q0.40", "q0.50", "q0.60", "q0.95"]
      qs_expected = pd.Index(
          [target_name + "_" + q for q in qs_expected]
      )
      # check that it works with retrain
      model = self.create_model(1, model_type=model_type)
      hist_fc = model.historical_forecasts(
          self.ts_pass_train,
          predict_likelihood_parameters=True,
          forecast_horizon=1,
          num_samples=1,
          start=len(self.ts_pass_train) - n,  # predict on last 10 steps
          retrain=True,
      )
      assert hist_fc.components.equals(qs_expected)
      assert len(hist_fc) == n
  
      # check for equal results between predict and hist fc without retraining
      model = self.create_model(1, model_type=model_type)
      model.fit(series=self.ts_pass_train[:-n])
      hist_fc = model.historical_forecasts(
          self.ts_pass_train,
          predict_likelihood_parameters=True,
          forecast_horizon=1,
          num_samples=1,
          start=len(self.ts_pass_train) - n,  # predict on last 10 steps
          retrain=False,
      )
      assert hist_fc.components.equals(qs_expected)
      assert len(hist_fc) == n
  
      preds = []
      for n_i in range(n):
          preds.append(
              model.predict(
                  n=1,
                  series=self.ts_pass_train[: -(n - n_i)],
                  predict_likelihood_parameters=True,
              )
          )
      preds = darts.concatenate(preds)
      np.testing.assert_array_almost_equal(
          preds.all_values(copy=False), hist_fc.all_values(copy=False)
      )
  
      # check equal results between predict and hist fc with higher output_chunk_length and horizon,
      # and last_points_only=False
      model = self.create_model(2, model_type=model_type)
      # we take one more training step so that model trained on ocl=1 has the same training samples
      # as model above
      model.fit(series=self.ts_pass_train[: -(n - 1)])
      hist_fc = model.historical_forecasts(
          self.ts_pass_train,
          predict_likelihood_parameters=True,
          forecast_horizon=2,
          num_samples=1,
          start=len(self.ts_pass_train) - n,  # predict on last 10 steps
          retrain=False,
          last_points_only=False,
          overlap_end=True,
      )
      # because of overlap_end, we get an additional prediction
      # generate the same predictions manually
      preds = []
      for n_i in range(n + 1):
          right = -(n - n_i) if n_i < 3 else len(self.ts_pass_train)
          preds.append(
              model.predict(
                  n=2,
                  series=self.ts_pass_train[:right],
                  predict_likelihood_parameters=True,
              )
          )
      for p, hfc in zip(preds, hist_fc):
          assert p.columns.equals(hfc.columns)
          assert p.time_index.equals(hfc.time_index)
          np.testing.assert_array_almost_equal(
              p.all_values(copy=False), hfc.all_values(copy=False)
          )
          assert len(hist_fc) == n + 1
  
imports: import itertools
  from itertools import product
  import numpy
  import pandas
  import pytest
  import darts
  from darts import TimeSeries, concatenate
  from darts.dataprocessing.transformers import Scaler
  from darts.datasets import AirPassengersDataset
  from darts.logging import get_logger
  from darts.models import ARIMA, AutoARIMA, CatBoostModel, LightGBMModel, LinearRegressionModel, NaiveSeasonal, NotImportedModule
  from darts.tests.conftest import tfm_kwargs
  from darts.utils import timeseries_generation
label_desc: Use image node_id 22 for calling the TestHistoricalforecast obj's underlying member method code with example usage: obj.test_predict_likelihood_parameters(model_type) without return types