Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Gregory Ashton
PyFstat
Commits
e7451ea9
Commit
e7451ea9
authored
May 04, 2017
by
Gregory Ashton
Browse files
Fix evidence calculation method
parent
0ca51fa7
Changes
1
Hide whitespace changes
Inline
Side-by-side
pyfstat/mcmc_based_searches.py
View file @
e7451ea9
...
...
@@ -358,6 +358,7 @@ class MCMCSearch(core.BaseSearchClass):
self
.
samples
=
d
[
'samples'
]
self
.
lnprobs
=
d
[
'lnprobs'
]
self
.
lnlikes
=
d
[
'lnlikes'
]
self
.
all_lnlikelihood
=
d
[
'all_lnlikelihood'
]
return
self
.
_initiate_search_object
()
...
...
@@ -418,7 +419,7 @@ class MCMCSearch(core.BaseSearchClass):
samples
=
sampler
.
chain
[
0
,
:,
nburn
:,
:].
reshape
((
-
1
,
self
.
ndim
))
lnprobs
=
sampler
.
lnprobability
[
0
,
:,
nburn
:].
reshape
((
-
1
))
lnlikes
=
sampler
.
lnlikelihood
[
0
,
:,
nburn
:].
reshape
((
-
1
))
all_lnlikelihood
=
sampler
.
lnlikelihood
all_lnlikelihood
=
sampler
.
lnlikelihood
[:,
:,
nburn
:]
self
.
samples
=
samples
self
.
lnprobs
=
lnprobs
self
.
lnlikes
=
lnlikes
...
...
@@ -1064,6 +1065,7 @@ class MCMCSearch(core.BaseSearchClass):
old_d
.
pop
(
'samples'
)
old_d
.
pop
(
'lnprobs'
)
old_d
.
pop
(
'lnlikes'
)
old_d
.
pop
(
'all_lnlikelihood'
)
mod_keys
=
[]
for
key
in
new_d
.
keys
():
...
...
@@ -1321,11 +1323,12 @@ class MCMCSearch(core.BaseSearchClass):
betas
[::
-
1
][::
2
][::
-
1
])
log10evidence_err
=
np
.
abs
(
z1
-
z2
)
/
np
.
log
(
10
)
print
(
"log10 evidence for {} = {} +/- {}"
.
format
(
self
.
label
,
log10evidence
,
log10evidence_err
))
ax1
.
semilogx
(
betas
,
mean_lnlikes
,
"-o"
)
ax1
.
set_xlabel
(
r
"$\beta$"
)
ax1
.
set_ylabel
(
r
"$\langle \log(\mathcal{L}) \rangle$"
)
print
(
"log10 evidence for {} = {} +/- {}"
.
format
(
self
.
label
,
log10evidence
,
log10evidence_err
))
min_betas
=
[]
evidence
=
[]
for
i
in
range
(
len
(
betas
)
/
2
):
...
...
@@ -1919,6 +1922,7 @@ class MCMCFollowUpSearch(MCMCSemiCoherentSearch):
self
.
samples
=
d
[
'samples'
]
self
.
lnprobs
=
d
[
'lnprobs'
]
self
.
lnlikes
=
d
[
'lnlikes'
]
self
.
all_lnlikelihood
=
d
[
'all_lnlikelihood'
]
self
.
nsegs
=
run_setup
[
-
1
][
1
]
return
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment