Posts

Showing posts with the label overflow

Weibull distribution calculation Runtimewarning overflow

Image
Clash Royale CLAN TAG #URR8PPP Weibull distribution calculation Runtimewarning overflow I was trying to use the code below to calculate the Weibull distribution, but I am getting a runtime warning of overflow exp: given that my data is a list of 6 members , but containing big numbers, it seems that the calculation takes a lot and my plot is not like what I see in the link. I used the fit and got the error : too many values to unpack (expected 2) Weibull example code 1 import scipy.stats as s import numpy as np import matplotlib.pyplot as plt def weib(x,n,a): return (a / n) * (x / n)**(a - 1) * np.exp(-(x / n)**a) data = [ 79000 , 85900 , 95000, 101000, 155250 , 280000] (loc, scale) = s.exponweib.fit_loc_scale(data, 1, 1) print loc, scale x = np.linspace(data[0], data[-1], 1000) plt.plot(x, weib(x, loc, scale)) plt.hist(data, data[-1], normed=True) plt.show() Method 2 : I tried this code : using this source ( code 2 ) data = [ 79000 , 85900 , 95000, 101000, 155250 , 280000] xdata...