MCPcopy
hub / github.com/hyperopt/hyperopt / build_posterior_wrapper

Function build_posterior_wrapper

hyperopt/tpe.py:794–827  ·  view source on GitHub ↗

Calls build_posterior Args: domain (hyperopt.base.Domain): contains info about the obj function and the hp space passed to fmin prior_weight (float): smoothing factor for counts, to avoid having 0 prob # TODO: consider renaming or improving documentation

(domain, prior_weight, gamma)

Source from the content-addressed store, hash-verified

792
793
794def build_posterior_wrapper(domain, prior_weight, gamma):
795 """
796 Calls build_posterior
797 Args:
798 domain (hyperopt.base.Domain): contains info about the obj function and the hp
799 space passed to fmin
800 prior_weight (float): smoothing factor for counts, to avoid having 0 prob
801 # TODO: consider renaming or improving documentation for suggest
802 gamma (float): the threshold to split between l(x) and g(x), see eq. 2 in
803 https://papers.nips.cc/paper/4443-algorithms-for-hyper-parameter-optimization.pdf
804
805 Returns:
806
807 """
808
809 # -- these dummy values will be replaced in build_posterior() and never used
810 observed = {"idxs": pyll.Literal(), "vals": pyll.Literal()}
811 observed_loss = {"idxs": pyll.Literal(), "vals": pyll.Literal()}
812
813 posterior = build_posterior(
814 # -- vectorized clone of bandit template
815 domain.vh.v_expr,
816 # -- this dict and next represent prior dists
817 domain.vh.idxs_by_label(),
818 domain.vh.vals_by_label(),
819 observed["idxs"],
820 observed["vals"],
821 observed_loss["idxs"],
822 observed_loss["vals"],
823 pyll.Literal(gamma),
824 pyll.Literal(float(prior_weight)),
825 )
826
827 return observed, observed_loss, posterior
828
829
830def suggest(

Callers 1

suggestFunction · 0.85

Calls 3

build_posteriorFunction · 0.85
idxs_by_labelMethod · 0.80
vals_by_labelMethod · 0.80

Tested by

no test coverage detected