src/orion/algo/tpe.py
def _sample_categorical_point(self, dimension, below_points, above_points):
        """Sample one value for categorical dimension based on the observed good and bad points"""
        choices = dimension.interval()

        below_points = [choices.index(point) for point in below_points]
        above_points = [choices.index(point) for point in above_points]

        sampler_below = CategoricalSampler(self, below_points, choices)
        candidate_points = sampler_below.sample(self.n_ei_candidates)

        if list(candidate_points):
            sampler_above = CategoricalSampler(self, above_points, choices)

            lik_below = sampler_below.get_loglikelis(candidate_points)
            lik_above = sampler_above.get_loglikelis(candidate_points)

            new_point_index = compute_max_ei_point(
                candidate_points, lik_below, lik_above
            )
            new_point = choices[new_point_index]

            return new_point
        return None
Sample one value for categorical dimension based on the observed good and bad points
Sample one value for categorical dimension based on the observed good and bad points
Sample one value for categorical dimension based on the observed good and bad points
def _sample_categorical_point(self, dimension, below_points, above_points):
        choices = dimension.interval()
        below_points = [choices.index(point) for point in below_points]
        above_points = [choices.index(point) for point in above_points]
        sampler_below = CategoricalSampler(self, below_points, choices)
        candidate_points = sampler_below.sample(self.n_ei_candidates)
        if list(candidate_points):
            sampler_above = CategoricalSampler(self, above_points, choices)
            lik_below = sampler_below.get_loglikelis(candidate_points)
            lik_above = sampler_above.get_loglikelis(candidate_points)
            new_point_index = compute_max_ei_point(
                candidate_points, lik_below, lik_above
            )
            new_point = choices[new_point_index]
            return new_point
        return None
def _sample_categorical_point ( self , dimension , below_points , above_points ) : choices = dimension . interval ( ) below_points = [ choices . index ( point ) for point in below_points ] above_points = [ choices . index ( point ) for point in above_points ] sampler_below = CategoricalSampler ( self , below_points , choices ) candidate_points = sampler_below . sample ( self . n_ei_candidates ) if list ( candidate_points ) : sampler_above = CategoricalSampler ( self , above_points , choices ) lik_below = sampler_below . get_loglikelis ( candidate_points ) lik_above = sampler_above . get_loglikelis ( candidate_points ) new_point_index = compute_max_ei_point ( candidate_points , lik_below , lik_above ) new_point = choices [ new_point_index ] return new_point return None
Sample one value for categorical dimension based on the observed good and bad points
Sample one value for categorical dimension based on the observed good and bad points
"""Sample one value for categorical dimension based on the observed good and bad points"""
self
dimension
below_points
above_points