def test_gaussian(self): mut.Gaussian() mut.Gaussian(0.5, 0.2) dut = mut.Gaussian(mean=1.0, stddev=0.1) dut.mean = 2.0 dut.stddev = 0.2 self._check_distribution(dut)
def test_distribution_variant(self): """Confirms that the free functions that operate on a variant are bound.""" items = [ mut.Deterministic(1.0), mut.Gaussian(1.0, 0.1), mut.Uniform(-1.0, 1.0), mut.UniformDiscrete([0.0, 1.0]), ] for item in items: copied = mut.ToDistribution(item) self._check_distribution(copied) mut.Sample(var=item, generator=RandomGenerator()) mut.Mean(var=item) mut.ToSymbolic(var=item) if mut.IsDeterministic(var=item): mut.GetDeterministicValue(var=item)