Exemple #1
0
def test_sampling_composite_beta_generator():
    parameter_space_subset = ParameterSpaceSubset()
    parameter_space_subset.generate(box,
                                    n,
                                    sampling=(DrawFrom(random.beta, a=2, b=5),
                                              DrawFrom(random.beta, a=5, b=1)))
    plot(0,
         box,
         parameter_space_subset,
         bins,
         stats.beta,
         a=2,
         b=5,
         loc=box[0][min],
         scale=box[0][max] - box[0][min])
    plot(1,
         box,
         parameter_space_subset,
         bins,
         stats.beta,
         a=5,
         b=1,
         loc=box[1][min],
         scale=box[1][max] - box[1][min])
    plt.show()
Exemple #2
0
 def __init__(self, a, b):
     assert isinstance(a, (list, tuple))
     assert isinstance(b, (list, tuple))
     assert len(a) == len(b)
     CompositeDistribution.__init__(
         self,
         [DrawFrom(random.beta, a=a_p, b=b_p) for (a_p, b_p) in zip(a, b)])
Exemple #3
0
def test_sampling_composite_log_uniform_and_beta():
    parameter_space_subset = ParameterSpaceSubset()
    parameter_space_subset.generate(box,
                                    n,
                                    sampling=(LogUniformDistribution(),
                                              DrawFrom(random.beta, a=2, b=5)))
    plot(0,
         box,
         parameter_space_subset,
         bins,
         stats_loguniform,
         loc=box[0][min],
         scale=box[0][max] - box[0][min])
    plot(1,
         box,
         parameter_space_subset,
         bins,
         stats.beta,
         a=2,
         b=5,
         loc=box[1][min],
         scale=box[1][max] - box[1][min])
    plt.show()