code: def adaptive_parzen_estimator(
      mus: numpy.ndarray | Sequence,
      low: float,
      high: float,
      prior_weight: float = 1.0,
      equal_weight: bool = False,
      flat_num: int = 25,
  ) -> tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray]:
      """Return the sorted mus, the corresponding sigmas and weights with adaptive kernel estimator.
  
      This adaptive parzen window estimator is based on the original papers and also refer the use of
      prior mean in `this implementation
      <https://github.com/hyperopt/hyperopt/blob/40bd617a0ca47e09368fb65919464ba0bfa85962/hyperopt/tpe.py#L400-L468>`_.
  
      :param mus: list of real values for observed mus.
      :param low: real value for lower bound of points.
      :param high: real value for upper bound of points.
      :param prior_weight: real value for the weight of the prior mean.
      :param equal_weight: bool value indicating if all points with equal weights.
      :param flat_num: int value indicating the number of the most recent trials which
          get the full weight where the others will be applied with a linear ramp
          from 0 to 1.0. It will only take effect if equal_weight is False.
      """
      mus = numpy.asarray(mus)
  
      prior_mu = (low + high) * 0.5
      prior_sigma = (high - low) * 1.0
  
      size = len(mus)
      if size > 1:
          order = numpy.argsort(mus)
          sorted_mus = mus[order]
          prior_mu_pos = numpy.searchsorted(sorted_mus, prior_mu)
  
          weights = ramp_up_weights(size, flat_num, equal_weight)
  
          mixture_mus = numpy.zeros(size + 1)
          mixture_mus[:prior_mu_pos] = sorted_mus[:prior_mu_pos]
          mixture_mus[prior_mu_pos] = prior_mu
          mixture_mus[prior_mu_pos + 1 :] = sorted_mus[prior_mu_pos:]
  
          mixture_weights = numpy.ones(size + 1)
          mixture_weights[:prior_mu_pos] = weights[:prior_mu_pos]
          mixture_weights[prior_mu_pos] = prior_weight
          mixture_weights[prior_mu_pos + 1 :] = weights[prior_mu_pos:]
  
          sigmas = numpy.ones(size + 1)
          sigmas[0] = mixture_mus[1] - mixture_mus[0]
          sigmas[-1] = mixture_mus[-1] - mixture_mus[-2]
          sigmas[1:-1] = numpy.maximum(
              (mixture_mus[1:-1] - mixture_mus[0:-2]),
              (mixture_mus[2:] - mixture_mus[1:-1]),
          )
          sigmas = numpy.clip(
              sigmas,
              prior_sigma / max(10, numpy.sqrt(size)),
              prior_sigma,
          )
  
      else:
          if prior_mu < mus[0]:
              mixture_mus = numpy.array([prior_mu, mus[0]])
              sigmas = numpy.array([prior_sigma, prior_sigma * 0.5])
              mixture_weights = numpy.array([prior_weight, 1.0])
          else:
              mixture_mus = numpy.array([mus[0], prior_mu])
              sigmas = numpy.array([prior_sigma * 0.5, prior_sigma])
              mixture_weights = numpy.array([1.0, prior_weight])
  
      weights = mixture_weights / mixture_weights.sum()
  
      return mixture_mus, sigmas, weights
  
imports: from __future__ import annotations
  import logging
  from typing import Any, Callable, ClassVar, Iterable, Sequence, TypeVar
  import numpy
  from scipy.stats import norm
  from scipy.stats.distributions import rv_frozen
  from orion.algo.base import BaseAlgorithm
  from orion.algo.base.parallel_strategy import ParallelStrategy, strategy_factory
  from orion.algo.space import Integer, Real, Space
  from orion.core.utils import format_trials
  from orion.core.utils.flatten import flatten
  from orion.core.worker.trial import Trial
label_desc: Use image node_id 3 for calling a global function with example usage: adaptive_parzen_estimator(mus, low, high, prior_weight, equal_weight, flat_num) and returns: mixture_mus,  sigmas,  weights