src/orion/algo/tpe.py
def _sample_real_point(self, dimension, below_points, above_points, is_log=False):
        """Sample one value for real dimension based on the observed good and bad points"""
        low, high = dimension.interval()
        if is_log:
            low = numpy.log(low)
            high = numpy.log(high)
            below_points = numpy.log(below_points)
            above_points = numpy.log(above_points)

        below_mus, below_sigmas, below_weights = adaptive_parzen_estimator(
            below_points,
            low,
            high,
            self.prior_weight,
            self.equal_weight,
            flat_num=self.full_weight_num,
        )
        above_mus, above_sigmas, above_weights = adaptive_parzen_estimator(
            above_points,
            low,
            high,
            self.prior_weight,
            self.equal_weight,
            flat_num=self.full_weight_num,
        )

        gmm_sampler_below = GMMSampler(
            self, below_mus, below_sigmas, low, high, below_weights
        )
        gmm_sampler_above = GMMSampler(
            self, above_mus, above_sigmas, low, high, above_weights
        )

        candidate_points = gmm_sampler_below.sample(self.n_ei_candidates)
        if candidate_points:
            lik_blow = gmm_sampler_below.get_loglikelis(candidate_points)
            lik_above = gmm_sampler_above.get_loglikelis(candidate_points)
            new_point = compute_max_ei_point(candidate_points, lik_blow, lik_above)

            if is_log:
                new_point = numpy.exp(new_point)

            return new_point

        return None
Sample one value for real dimension based on the observed good and bad points
Sample one value for real dimension based on the observed good and bad points
Sample one value for real dimension based on the observed good and bad points
def _sample_real_point(self, dimension, below_points, above_points, is_log=False):
        low, high = dimension.interval()
        if is_log:
            low = numpy.log(low)
            high = numpy.log(high)
            below_points = numpy.log(below_points)
            above_points = numpy.log(above_points)
        below_mus, below_sigmas, below_weights = adaptive_parzen_estimator(
            below_points,
            low,
            high,
            self.prior_weight,
            self.equal_weight,
            flat_num=self.full_weight_num,
        )
        above_mus, above_sigmas, above_weights = adaptive_parzen_estimator(
            above_points,
            low,
            high,
            self.prior_weight,
            self.equal_weight,
            flat_num=self.full_weight_num,
        )
        gmm_sampler_below = GMMSampler(
            self, below_mus, below_sigmas, low, high, below_weights
        )
        gmm_sampler_above = GMMSampler(
            self, above_mus, above_sigmas, low, high, above_weights
        )
        candidate_points = gmm_sampler_below.sample(self.n_ei_candidates)
        if candidate_points:
            lik_blow = gmm_sampler_below.get_loglikelis(candidate_points)
            lik_above = gmm_sampler_above.get_loglikelis(candidate_points)
            new_point = compute_max_ei_point(candidate_points, lik_blow, lik_above)
            if is_log:
                new_point = numpy.exp(new_point)
            return new_point
        return None
def _sample_real_point ( self , dimension , below_points , above_points , is_log = False ) : low , high = dimension . interval ( ) if is_log : low = numpy . log ( low ) high = numpy . log ( high ) below_points = numpy . log ( below_points ) above_points = numpy . log ( above_points ) below_mus , below_sigmas , below_weights = adaptive_parzen_estimator ( below_points , low , high , self . prior_weight , self . equal_weight , flat_num = self . full_weight_num , ) above_mus , above_sigmas , above_weights = adaptive_parzen_estimator ( above_points , low , high , self . prior_weight , self . equal_weight , flat_num = self . full_weight_num , ) gmm_sampler_below = GMMSampler ( self , below_mus , below_sigmas , low , high , below_weights ) gmm_sampler_above = GMMSampler ( self , above_mus , above_sigmas , low , high , above_weights ) candidate_points = gmm_sampler_below . sample ( self . n_ei_candidates ) if candidate_points : lik_blow = gmm_sampler_below . get_loglikelis ( candidate_points ) lik_above = gmm_sampler_above . get_loglikelis ( candidate_points ) new_point = compute_max_ei_point ( candidate_points , lik_blow , lik_above ) if is_log : new_point = numpy . exp ( new_point ) return new_point return None
Sample one value for real dimension based on the observed good and bad points
Sample one value for real dimension based on the observed good and bad points
"""Sample one value for real dimension based on the observed good and bad points"""
self
dimension
below_points
above_points
is_log