check_posterior_sampler_options: make global variable an input
Does not properly work for scale_file-option as caller has variable not globaltrustregion
parent
e1d0ce28d2
commit
217de5084c
|
@ -1,19 +1,23 @@
|
||||||
function [posterior_sampler_options, options_] = check_posterior_sampler_options(posterior_sampler_options, options_, bounds)
|
function [posterior_sampler_options, options_, bayestopt_] = check_posterior_sampler_options(posterior_sampler_options, options_, bounds, bayestopt_)
|
||||||
|
|
||||||
% function [posterior_sampler_options, options_] = check_posterior_sampler_options(posterior_sampler_options, options_, bounds)
|
% function [posterior_sampler_options, options_, bayestopt_] = check_posterior_sampler_options(posterior_sampler_options, options_, bounds, bayestopt_)
|
||||||
% initialization of posterior samplers
|
% initialization of posterior samplers
|
||||||
%
|
%
|
||||||
% INPUTS
|
% INPUTS
|
||||||
% posterior_sampler_options: posterior sampler options
|
% posterior_sampler_options: posterior sampler options
|
||||||
% options_: structure storing the options
|
% options_: structure storing the options
|
||||||
|
% bounds: structure containing prior bounds
|
||||||
|
% bayestopt_: structure storing information about priors
|
||||||
|
|
||||||
% OUTPUTS
|
% OUTPUTS
|
||||||
% posterior_sampler_options: checked posterior sampler options
|
% posterior_sampler_options: checked posterior sampler options
|
||||||
|
% options_: structure storing the options
|
||||||
|
% bayestopt_: structure storing information about priors
|
||||||
%
|
%
|
||||||
% SPECIAL REQUIREMENTS
|
% SPECIAL REQUIREMENTS
|
||||||
% none
|
% none
|
||||||
|
|
||||||
% Copyright (C) 2015-2017 Dynare Team
|
% Copyright (C) 2015-2022 Dynare Team
|
||||||
%
|
%
|
||||||
% This file is part of Dynare.
|
% This file is part of Dynare.
|
||||||
%
|
%
|
||||||
|
@ -86,7 +90,6 @@ if init
|
||||||
% will overwrite jscale from set_prior.m
|
% will overwrite jscale from set_prior.m
|
||||||
if exist(options_list{i,2},'file') || exist([options_list{i,2},'.mat'],'file')
|
if exist(options_list{i,2},'file') || exist([options_list{i,2},'.mat'],'file')
|
||||||
tmp = load(options_list{i,2},'Scale');
|
tmp = load(options_list{i,2},'Scale');
|
||||||
global bayestopt_
|
|
||||||
bayestopt_.mh_jscale = tmp.Scale;
|
bayestopt_.mh_jscale = tmp.Scale;
|
||||||
options_.mh_jscale = tmp.Scale;
|
options_.mh_jscale = tmp.Scale;
|
||||||
bayestopt_.jscale = ones(size(bounds.lb,1),1)*tmp.Scale;
|
bayestopt_.jscale = ones(size(bounds.lb,1),1)*tmp.Scale;
|
||||||
|
@ -152,7 +155,6 @@ if init
|
||||||
% will overwrite jscale from set_prior.m
|
% will overwrite jscale from set_prior.m
|
||||||
if exist(options_list{i,2},'file') || exist([options_list{i,2},'.mat'],'file')
|
if exist(options_list{i,2},'file') || exist([options_list{i,2},'.mat'],'file')
|
||||||
tmp = load(options_list{i,2},'Scale');
|
tmp = load(options_list{i,2},'Scale');
|
||||||
global bayestopt_
|
|
||||||
bayestopt_.mh_jscale = tmp.Scale;
|
bayestopt_.mh_jscale = tmp.Scale;
|
||||||
options_.mh_jscale = tmp.Scale;
|
options_.mh_jscale = tmp.Scale;
|
||||||
bayestopt_.jscale = ones(size(bounds.lb,1),1)*tmp.Scale;
|
bayestopt_.jscale = ones(size(bounds.lb,1),1)*tmp.Scale;
|
||||||
|
|
|
@ -465,7 +465,7 @@ if (any(bayestopt_.pshape >0 ) && options_.mh_replic) || ...
|
||||||
if options_.mh_replic || options_.load_mh_file
|
if options_.mh_replic || options_.load_mh_file
|
||||||
posterior_sampler_options = options_.posterior_sampler_options.current_options;
|
posterior_sampler_options = options_.posterior_sampler_options.current_options;
|
||||||
posterior_sampler_options.invhess = invhess;
|
posterior_sampler_options.invhess = invhess;
|
||||||
[posterior_sampler_options, options_] = check_posterior_sampler_options(posterior_sampler_options, options_);
|
[posterior_sampler_options, options_, bayestopt_] = check_posterior_sampler_options(posterior_sampler_options, options_, bounds, bayestopt_);
|
||||||
% store current options in global
|
% store current options in global
|
||||||
options_.posterior_sampler_options.current_options = posterior_sampler_options;
|
options_.posterior_sampler_options.current_options = posterior_sampler_options;
|
||||||
if options_.mh_replic
|
if options_.mh_replic
|
||||||
|
|
|
@ -649,7 +649,7 @@ if options_.load_results_after_load_mh
|
||||||
end
|
end
|
||||||
|
|
||||||
if options_.mh_replic || options_.load_mh_file
|
if options_.mh_replic || options_.load_mh_file
|
||||||
[current_options, options_] = check_posterior_sampler_options([], options_, bounds);
|
[current_options, options_, bayestopt_] = check_posterior_sampler_options([], options_, bounds, bayestopt_);
|
||||||
options_.posterior_sampler_options.current_options = current_options;
|
options_.posterior_sampler_options.current_options = current_options;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue