def compare_fits(x):
shape, scale = fit(x)
app_shape, app_scale = x.mean() / x.std(), x.mean()
# _, np_shape, _, np_scale = exponweib.fit(x, floc=0)
# # Plot
# def weib(x, n, a): # a == shape
# return (a / n) * (x / n)**(a - 1) * np.exp(-(x / n)**a)
#
# count, _, _ = plt.hist(x, 100)
# xx = np.linspace(x.min(), x.max(), 10000)
# yy = weib(xx, scale, shape)
# yy_app = weib(xx, app_scale, app_shape)
# yy_np = weib(xx, np_scale, np_shape)
# plt.plot(xx, yy*(count.max() / yy.max()), label='MLE')
# plt.plot(xx, yy_app*(count.max() / yy_app.max()), label='App')
# plt.plot(xx, yy_np*(count.max() / yy_np.max()), label='Scipy')
# plt.legend()
# plt.show()
return (shape, scale), (app_shape, app_scale)
评论列表
文章目录