class_docstr: This is a Tree Parzen Estimator (TPE) algorithm as found in Hyperopt,
  that is better than the Random Search algorithm and supports supporting
  intelligent exploration v.s. exploitation of the search space over time,
  using Neuraxle hyperparameters.
  
  Here, the algorithm is modified compared to the original one, as it uses a
  :class:`neuraxle.metaopt.automl.GridExplorationSampler` instead of a random search
  to pick the first exploration samples to furthermore explore the space at the beginning.
docstr: Initialize the TPE with some configuration.
  
  :param number_of_initial_random_step: Number of random steps to take before starting the optimization.
  :param quantile_threshold: threshold between 0 and 1 representing the proportion of good trials to keep.
  :param number_good_trials_max_cap: maximum number of good trials to keep, that will cap the `quantile_threshold`.
  :param number_possible_hyperparams_candidates: number of possible hyperparams candidates to explore in the `good / bad` trials posterior.
  :param use_linear_forgetting_weights: if True, the weights will be linearly decreasing past the `number_recent_trial_at_full_weights`.
  :param number_recent_trials_at_full_weights: number of recent trials to use at full weights before linear forgetting when `use_linear_forgetting_weights` is set to True.
docstr_tok: ["Initialize","the","TPE","with","some","configuration",".",":","param","number_of_initial_random_step",":","Number","of","random","steps","to","take","before","starting","the","optimization",".",":","param","quantile_threshold",":","threshold","between","0","and","1","representing","the","proportion","of","good","trials","to","keep",".",":","param","number_good_trials_max_cap",":","maximum","number","of","good","trials","to","keep",",","that","will","cap","the","`","quantile_threshold","`",".",":","param","number_possible_hyperparams_candidates",":","number","of","possible","hyperparams","candidates","to","explore","in","the","`","good","\/","bad","`","trials","posterior",".",":","param","use_linear_forgetting_weights",":","if","True",",","the","weights","will","be","linearly","decreasing","past","the","`","number_recent_trial_at_full_weights","`",".",":","param","number_recent_trials_at_full_weights",":","number","of","recent","trials","to","use","at","full","weights","before","linear","forgetting","when","`","use_linear_forgetting_weights","`","is","set","to","True","."]
code: def __init__(
      self,
      number_of_initial_random_step: int = 15,
      quantile_threshold: float = 0.3,
      number_good_trials_max_cap: int = 25,
      number_possible_hyperparams_candidates: int = 100,
      use_linear_forgetting_weights: bool = False,
      number_recent_trials_at_full_weights: int = 25,
  ):
      """
      Initialize the TPE with some configuration.
  
      :param number_of_initial_random_step: Number of random steps to take before starting the optimization.
      :param quantile_threshold: threshold between 0 and 1 representing the proportion of good trials to keep.
      :param number_good_trials_max_cap: maximum number of good trials to keep, that will cap the `quantile_threshold`.
      :param number_possible_hyperparams_candidates: number of possible hyperparams candidates to explore in the `good / bad` trials posterior.
      :param use_linear_forgetting_weights: if True, the weights will be linearly decreasing past the `number_recent_trial_at_full_weights`.
      :param number_recent_trials_at_full_weights: number of recent trials to use at full weights before linear forgetting when `use_linear_forgetting_weights` is set to True.
      """
      super().__init__()
  
      self.number_of_initial_random_step: int = (
          number_of_initial_random_step
      )
      self.number_possible_hyperparams_candidates: int = (
          number_possible_hyperparams_candidates
      )
  
      self.mixture_factory: _DividedMixturesFactory = (
          _DividedMixturesFactory(
              quantile_threshold,
              number_good_trials_max_cap,
              use_linear_forgetting_weights,
              number_recent_trials_at_full_weights,
          )
      )
  
      self.initial_auto_ml_algo: BaseHyperparameterOptimizer = (
          GridExplorationSampler(
              expected_n_trials=number_of_initial_random_step
          )
      )
  
imports: from collections import Counter
  from operator import itemgetter
  from typing import Any, List, Tuple, Union
  import numpy
  from neuraxle.hyperparams.distributions import Choice, DiscreteHyperparameterDistribution, DistributionMixture, HPSampledValue, HyperparameterDistribution, LogSpaceDistributionMixin, PriorityChoice, Quantized
  from neuraxle.hyperparams.space import HyperparameterSamples, HyperparameterSpace
  from neuraxle.metaopt.data.reporting import RoundReport, TrialReport
  from neuraxle.metaopt.optimizer import BaseHyperparameterOptimizer, GridExplorationSampler
label_desc: Use image node_id 1 to create a new TreeParzenEstimator object from inherited base classes: BaseHyperparameterOptimizer with example: obj = TreeParzenEstimator(number_of_initial_random_step, quantile_threshold, number_good_trials_max_cap, number_possible_hyperparams_candidates, use_linear_forgetting_weights, number_recent_trials_at_full_weights)