def test_weibull(rnd, c, loc=0, scale=1): # weibull random variate generator weibull_dist = RVGs.Weibull(c, loc, scale) # obtain samples samples = get_samples(weibull_dist, rnd) # get theoretical variance var = scipy.weibull_min.stats(c, loc, scale, moments='v') var = np.asarray(var).item() # report mean and variance print_test_results('Weibull', samples, expectation=math.gamma(1.0 + 1 / c) * scale + loc, variance=var)
print("Fitting Normal:", dictResults) # 14 Triangular dist = RVGs.Triangular(0.5, loc=1, scale=2) dat_tri = np.array(get_samples(dist, np.random)) dictResults = Fit.fit_triang(dat_tri, 'Data', fixed_location=1) # fit print("Fitting Triangular:", dictResults) # 15 Uniform dist = RVGs.Uniform(0, 1) dat_unif = np.array(get_samples(dist, np.random)) # mean, sigma dictResults = Fit.fit_uniform(dat_unif, 'Data') # fit print("Fitting Uniform:", dictResults) # 16 UniformDiscrete dist = RVGs.UniformDiscrete(0, 100) dat_unifDis = np.array(get_samples(dist, np.random)) dictResults = Fit.fit_uniformDiscrete(dat_unifDis, 'Data') # fit print("Fitting UniformDiscrete:", dictResults) # 17 fitting a Weibull distribution dist = RVGs.Weibull(5, 1, 2) dat_weibull = np.array(get_samples(dist, np.random)) # generate data dictResults = Fit.fit_weibull(dat_weibull, 'Data', fixed_location=1) # fit print("Fitting Weibull:", dictResults) # 18 fitting a Poisson distribution dist = RVGs.Poisson(30, 1) dat_poisson = np.array(get_samples(dist, np.random)) # generate data dictResults = Fit.fit_poisson(dat_poisson, 'Data', fixed_location=1) # fit print("Fitting Poisson:", dictResults)