-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
5 changed files
with
48 additions
and
5 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import os | ||
os.chdir('..') | ||
import sys | ||
sys.path.insert(1, 'utils') | ||
from ess import get_ess_leapfrog_ratio | ||
|
||
import pickle | ||
import numpy as np | ||
import matplotlib.pyplot as plt | ||
import arviz as az | ||
|
||
|
||
|
||
parameters = [{'alpha':[0.1]*10, 'N':10}, {'alpha':[0.1]*100, 'N':100}, {'alpha': [0.1]*1000, 'N': 1000}, | ||
{'alpha':[1]*10, 'N':10}, {'alpha':[1]*100, 'N':100}, {'alpha': [1]*1000, 'N': 1000}, | ||
{'alpha':[10]*10, 'N':10}, {'alpha':[10]*100, 'N':100}, {'alpha': [1]*1000, 'N': 1000}] | ||
|
||
transforms = ['stickbreaking', 'softmax', 'softmax-augmented', 'stan'] | ||
transform_category='simplex' | ||
evaluating_model='dirichlet_symmetric' | ||
|
||
var_name='x' | ||
var_dim=0 | ||
|
||
plt.rcParams["figure.figsize"] = (20,10) | ||
fig, axes = plt.subplots(3,3) | ||
for ax, params in zip(axes.flatten() if len(parameters)>1 else [axes], parameters): | ||
for transform in transforms: | ||
x, y = get_ess_leapfrog_ratio(transform_category, transform, evaluating_model, params, var_name, var_dim, n_repeat=100, plot_type='cdf') | ||
ax.plot(x,y, label=transform) | ||
ax.set_title(f'alpha = {params["alpha"][0]}, N = {params["N"]}') | ||
ax.axes.yaxis.set_ticklabels([]) | ||
fig.supxlabel('ESS/Leapfrog') | ||
fig.supylabel('Cumulative Density') | ||
plt.legend() | ||
plt.savefig('figures/simplex/ess_cdf.png', dpi=300) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters