code: def test_init_parzen_estimator(
      consider_prior: bool, multivariate: bool
  ) -> None:
      parameters = _ParzenEstimatorParameters(
          consider_prior=consider_prior,
          prior_weight=1.0,
          consider_magic_clip=False,
          consider_endpoints=False,
          weights=lambda x: np.arange(x) + 1.0,
          multivariate=multivariate,
          categorical_distance_func={},
      )
  
      mpe = _ParzenEstimator(
          MULTIVARIATE_SAMPLES, SEARCH_SPACE, parameters
      )
  
      weights = np.array([1] + consider_prior * [1], dtype=float)
      weights /= weights.sum()
  
      expected_univariate = _MixtureOfProductDistribution(
          weights=weights,
          distributions=[
              _BatchedTruncNormDistributions(
                  mu=np.array([1.0] + consider_prior * [50.5]),
                  sigma=np.array(
                      [49.5 if consider_prior else 99.0]
                      + consider_prior * [99.0]
                  ),
                  low=1.0,
                  high=100.0,
              ),
              _BatchedTruncNormDistributions(
                  mu=np.array(
                      [np.log(1.0)]
                      + consider_prior * [np.log(100) / 2.0]
                  ),
                  sigma=np.array(
                      [
                          np.log(100) / 2
                          if consider_prior
                          else np.log(100.0)
                      ]
                      + consider_prior * [np.log(100)]
                  ),
                  low=np.log(1.0),
                  high=np.log(100.0),
              ),
              _BatchedDiscreteTruncNormDistributions(
                  mu=np.array([1.0] + consider_prior * [50.5]),
                  sigma=np.array(
                      [49.5 if consider_prior else 100.5]
                      + consider_prior * [102.0]
                  ),
                  low=1.0,
                  high=100.0,
                  step=3.0,
              ),
              _BatchedDiscreteTruncNormDistributions(
                  mu=np.array([1.0] + consider_prior * [50.5]),
                  sigma=np.array(
                      [49.5 if consider_prior else 99.5]
                      + consider_prior * [100.0]
                  ),
                  low=1,
                  high=100,
                  step=1,
              ),
              _BatchedTruncNormDistributions(
                  mu=np.array(
                      [np.log(1.0)]
                      + consider_prior
                      * [(np.log(100.5) + np.log(0.5)) / 2.0]
                  ),
                  sigma=np.array(
                      [
                          (np.log(100.5) + np.log(0.5)) / 2
                          if consider_prior
                          else np.log(100.5)
                      ]
                      + consider_prior * [np.log(100.5) - np.log(0.5)]
                  ),
                  low=np.log(0.5),
                  high=np.log(100.5),
              ),
              _BatchedCategoricalDistributions(
                  np.array(
                      [
                          [0.2, 0.6, 0.2],
                          [1.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0],
                      ]
                  )
                  if consider_prior
                  else np.array([[0.25, 0.5, 0.25]])
              ),
              _BatchedCategoricalDistributions(
                  np.array(
                      [
                          [1.0 / 6.0, 0.5, 1.0 / 6.0, 1.0 / 6.0],
                          [1.0 / 4.0, 1.0 / 4.0, 1.0 / 4.0, 1.0 / 4.0],
                      ]
                  )
                  if consider_prior
                  else np.array([[0.2, 0.4, 0.2, 0.2]])
              ),
          ],
      )
      SIGMA0 = 0.2
      expected_multivarite = _MixtureOfProductDistribution(
          weights=weights,
          distributions=[
              _BatchedTruncNormDistributions(
                  mu=np.array([1.0] + consider_prior * [50.5]),
                  sigma=np.array(
                      [SIGMA0 * 99.0] + consider_prior * [99.0]
                  ),
                  low=1.0,
                  high=100.0,
              ),
              _BatchedTruncNormDistributions(
                  mu=np.array(
                      [np.log(1.0)]
                      + consider_prior * [np.log(100) / 2.0]
                  ),
                  sigma=np.array(
                      [SIGMA0 * np.log(100)]
                      + consider_prior * [np.log(100)]
                  ),
                  low=np.log(1.0),
                  high=np.log(100.0),
              ),
              _BatchedDiscreteTruncNormDistributions(
                  mu=np.array([1.0] + consider_prior * [50.5]),
                  sigma=np.array(
                      [SIGMA0 * 102.0] + consider_prior * [102.0]
                  ),
                  low=1.0,
                  high=100.0,
                  step=3.0,
              ),
              _BatchedDiscreteTruncNormDistributions(
                  mu=np.array([1.0] + consider_prior * [50.5]),
                  sigma=np.array(
                      [SIGMA0 * 100.0] + consider_prior * [100.0]
                  ),
                  low=1,
                  high=100,
                  step=1,
              ),
              _BatchedTruncNormDistributions(
                  mu=np.array(
                      [np.log(1.0)]
                      + consider_prior
                      * [(np.log(100.5) + np.log(0.5)) / 2.0]
                  ),
                  sigma=np.array(
                      [SIGMA0 * (np.log(100.5) - np.log(0.5))]
                      + consider_prior * [np.log(100.5) - np.log(0.5)]
                  ),
                  low=np.log(0.5),
                  high=np.log(100.5),
              ),
              _BatchedCategoricalDistributions(
                  np.array(
                      [
                          [0.2, 0.6, 0.2],
                          [1.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0],
                      ]
                  )
                  if consider_prior
                  else np.array([[0.25, 0.5, 0.25]])
              ),
              _BatchedCategoricalDistributions(
                  np.array(
                      [
                          [1.0 / 6.0, 0.5, 1.0 / 6.0, 1.0 / 6.0],
                          [1.0 / 4.0, 1.0 / 4.0, 1.0 / 4.0, 1.0 / 4.0],
                      ]
                      if consider_prior
                      else np.array([[0.2, 0.4, 0.2, 0.2]])
                  )
              ),
          ],
      )
  
      expected = (
          expected_multivarite if multivariate else expected_univariate
      )
  
      # Test that the distribution is correct.
      assert_distribution_almost_equal(
          mpe._mixture_distribution, expected
      )
  
      # Test that the sampled values are valid.
      samples = mpe.sample(np.random.RandomState(0), 10)
      for param, values in samples.items():
          for value in values:
              assert SEARCH_SPACE[param]._contains(value)
  
imports: from typing import Callable
  from typing import Dict
  from typing import List
  import numpy
  import pytest
  from optuna import distributions
  from optuna.distributions import CategoricalChoiceType
  from optuna.samplers._tpe.parzen_estimator import _ParzenEstimator
  from optuna.samplers._tpe.parzen_estimator import _ParzenEstimatorParameters
  from optuna.samplers._tpe.probability_distributions import _BatchedCategoricalDistributions
  from optuna.samplers._tpe.probability_distributions import _BatchedDiscreteTruncNormDistributions
  from optuna.samplers._tpe.probability_distributions import _BatchedTruncNormDistributions
  from optuna.samplers._tpe.probability_distributions import _MixtureOfProductDistribution
  from optuna.samplers._tpe.sampler import default_weights
label_desc: Use image node_id 2 for calling a global function with example usage: test_init_parzen_estimator(consider_prior, multivariate) without return types