-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
38f165f
commit 7a59391
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
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,28 @@ | ||
from benchmarks.benchmarks_mchmc import * | ||
from sampling.sampler import Sampler | ||
from benchmarks import german_credit | ||
import pandas as pd | ||
|
||
|
||
|
||
def test(): | ||
|
||
names = ['Ill-Conditioned', 'Bi-Modal', 'Rosenbrock', "Neal's Funnel", 'German Credit', 'Stochastic Volatility'] | ||
targets = [IllConditionedGaussian(100, 100.0), BiModal(), Rosenbrock(), Funnel(), german_credit.Target(), StochasticVolatility()] | ||
|
||
def ESS(target, num_samples): | ||
sampler = Sampler(target, integrator= 'MN') | ||
ess= jnp.average(sampler.sample(num_samples, 12, output= 'ess')) | ||
return ess, sampler.L / np.sqrt(target.d), sampler.eps | ||
|
||
num_samples= [30000, 100000, 300000, 100000, 100000, 10000] | ||
|
||
results = np.array([ESS(targets[i], num_samples[i]) for i in range(len(names))]) | ||
df = pd.DataFrame({'Target ': names, 'ESS': results[:, 0], 'alpha': results[:, 1], 'eps': results[:, 2]}) | ||
print(df) | ||
|
||
|
||
|
||
|
||
test() | ||
|