MCPcopy
hub / github.com/hyperopt/hyperopt / pmin_sampled

Function pmin_sampled

hyperopt/utils.py:121–138  ·  view source on GitHub ↗

Probability that each Gaussian-dist R.V. is less than the others :param vscores: mean vector :param var: variance vector This function works by sampling n_samples from every (gaussian) mean distribution, and counting up the number of times each element's sample is the best.

(mean, var, n_samples=1000, rng=None)

Source from the content-addressed store, hash-verified

119
120
121def pmin_sampled(mean, var, n_samples=1000, rng=None):
122 """Probability that each Gaussian-dist R.V. is less than the others
123
124 :param vscores: mean vector
125 :param var: variance vector
126
127 This function works by sampling n_samples from every (gaussian) mean distribution,
128 and counting up the number of times each element's sample is the best.
129
130 """
131 if rng is None:
132 rng = numpy.random.default_rng(232342)
133
134 samples = rng.standard_normal((n_samples, len(mean))) * numpy.sqrt(var) + mean
135 winners = (samples.T == samples.min(axis=1)).T
136 wincounts = winners.sum(axis=0)
137 assert wincounts.shape == mean.shape
138 return old_div(wincounts.astype("float64"), wincounts.sum())
139
140
141def fast_isin(X, Y):

Callers 1

average_best_errorMethod · 0.85

Calls 1

minMethod · 0.80

Tested by

no test coverage detected