Skip to content

Commit

Permalink
Retune Weibull fit
Browse files Browse the repository at this point in the history
  • Loading branch information
camirmas committed May 5, 2023
1 parent 9fc53be commit e9e642a
Show file tree
Hide file tree
Showing 2 changed files with 287 additions and 285 deletions.
12 changes: 7 additions & 5 deletions REStats/models/weibull.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@ def weibull_model(data):
Returns:
None
"""
mu = np.log(data.mean())

shape = pyro.sample("shape", dist.Gamma(2, 1))
scale = pyro.sample("scale", dist.LogNormal(mu, 0.5))
shape = pyro.sample("shape", dist.Gamma(2.5, 1))
scale = pyro.sample("scale", dist.Gamma(3, 0.5))

with pyro.plate("data", len(data)):
pyro.sample("obs", dist.Weibull(scale, shape), obs=data)
Expand Down Expand Up @@ -96,11 +94,15 @@ def calc_m(shape):
def plot_prior_samples(idata_wb):
fig, ax = plt.subplots()
ax.set_title("Weibull prior distributions")
ax.set_xmargin(0)
ax.set_xlabel("Wind Speed (m/s)")
ax.set_ylabel("Density")
ax.set_ylim(top=2.5)

shapes = idata_wb.prior.shape[0, :10]
scales = idata_wb.prior.scale[0, :10]

x = np.linspace(0, 12, 500)
x = np.linspace(0, 16, 500)

def weib(x, scale, shape):
return (
Expand Down
560 changes: 280 additions & 280 deletions REStats/notebooks/forecast.ipynb

Large diffs are not rendered by default.

0 comments on commit e9e642a

Please sign in to comment.