Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Gitlab is now running v13.9.0 - More info ->
here
<-
Open sidebar
cosmotools
CAMEL
Commits
7724a41b
Commit
7724a41b
authored
Sep 28, 2019
by
Plaszczynski Stephane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
correct mcm for dim=1 + messages. add accessor to Combiner
parent
61d0b356
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
7 deletions
+22
-7
src/camel/Chi2Combiner.hh
src/camel/Chi2Combiner.hh
+2
-1
src/camel/MCMC/MCMC_adaptive.cc
src/camel/MCMC/MCMC_adaptive.cc
+20
-6
No files found.
src/camel/Chi2Combiner.hh
View file @
7724a41b
...
...
@@ -49,10 +49,11 @@ public:
//is the computation a success
bool
success
()
const
{
return
OK
;}
//accessor to engine
Engine
*
getEngine
()
{
return
engine
;}
const
std
::
vector
<
Chi2Data
*>&
chi2s
()
const
{
return
obs
;}
private:
std
::
vector
<
Chi2Data
*>
obs
;
Timer
*
timer
;
...
...
src/camel/MCMC/MCMC_adaptive.cc
View file @
7724a41b
...
...
@@ -193,6 +193,11 @@ void MCMC_adaptive::fill_chain(pdf* target_func, pdf* proposal,int init_step, co
///////////////////////////////////////main loop////////////////////////
for
(
int
i
=
2
;
i
<
_length
;
i
++
)
{
if
(
i
==
2
)
cout
<<
">>> Metropolis phase with scale="
<<
g
->
Get_scale
()
<<
endl
;
if
((
_verbose
==
true
)
&&
(
i
%
1000
==
0
))
{
cout
<<
"step="
<<
i
<<
endl
;
...
...
@@ -216,12 +221,15 @@ void MCMC_adaptive::fill_chain(pdf* target_func, pdf* proposal,int init_step, co
//first extimation of covariance to be redone
//cout << "matrix_0="<<g->Get_cov_matrix() << endl;
extract_cov
(
0
,
i
-
1
,
false
);
g
->
Set_cov_matrix
(
_extracted_cov
);
g
->
Set_cov_matrix
(
_extracted_cov
);
if
(
_verbose
)
cout
<<
"matrix_t0="
<<
g
->
Get_cov_matrix
()
<<
endl
;
flag_shoot
=
proposal
->
shoot
(
jump
,
true
);
if
(
_dim
==
1
)
g
->
Set_scale
(
0.1
);
else
g
->
Set_scale
(
2.4
*
2.4
/
_dim
);
//g->Set_scale(1.0);
//if(_dim==1) g->Set_scale(0.1);
g
->
Set_scale
(
2.4
*
2.4
/
_dim
);
cout
<<
">>> i="
<<
_t0
<<
": starting cov adapatation with fixed scale="
<<
g
->
Get_scale
()
<<
endl
;
}
else
//from here starts adaptation process
...
...
@@ -255,13 +263,19 @@ void MCMC_adaptive::fill_chain(pdf* target_func, pdf* proposal,int init_step, co
cout
<<
"scale="
<<
scale
<<
endl
;
}
if
(
i
>
_t0
+
_ts
)
{
{
if
(
i
==
(
_t0
+
_ts
+
1
)){
cout
<<
">>> i="
<<
i
<<
": starting scale adaptation="
<<
g
->
Get_scale
()
<<
endl
;
}
double
ar
=
acc_rate
(
i
-
100
,
i
);
if
((
_verbose
==
true
)
||
(
i
%
1000
==
0
))
{
cout
<<
"acc rate="
<<
ar
<<
endl
;
}
g
->
Set_scale
(
g
->
Get_scale
()
+
(
ar
-
0.25
)
*
gamma_i
);
double
ar_target
=
(
_dim
<=
2
?
0.5
:
0.25
);
g
->
Set_scale
(
g
->
Get_scale
()
+
(
ar
-
ar_target
)
*
gamma_i
);
double
scale_min
=
0.001
;
if
(
scale
<
scale_min
)
{
g
->
Set_scale
(
scale_min
);}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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