File: banana.py

package info (click to toggle)
python-bumps 0.7.11-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 10,264 kB
  • sloc: python: 22,226; ansic: 4,973; cpp: 4,849; xml: 493; makefile: 163; perl: 108; sh: 101
file content (28 lines) | stat: -rwxr-xr-x 587 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env python

"""
The Rosenbrock banana function
"""
from dream import *
from pylab import *

def rosen(x):
    x = asarray(x)
    return sum(100.0*(x[1:]-x[:-1]**2)**2 + (1-x[:-1])**2)

n=6
sampler = Dream(model=LogDensity(rosen),
                population=randn(2*n,5,n),
                thinning=1,
                draws=25000,
                burn=10000,
                #DE_snooker_rate=0,
                #cycles=3,
                )

state = sampler.sample()
state.mark_outliers()
state.title = "Banana function example"
#plot_corr(state); show()
plot_all(state)
show()