adding a check to Metropolis Hasting initialization in order not to accept a penalized posterior value
parent
40403e9e40
commit
c574544b16
|
@ -95,6 +95,9 @@ if ~options_.load_mh_file & ~options_.mh_recover
|
|||
if all(candidate(:) > mh_bounds(:,1)) & all(candidate(:) < mh_bounds(:,2))
|
||||
ix2(j,:) = candidate;
|
||||
ilogpo2(j) = - feval(TargetFun,ix2(j,:)',varargin{:});
|
||||
if ilogpo2(j) <= - bayestopt_.penalty+1e-6
|
||||
validate = 0;
|
||||
else
|
||||
fprintf(fidlog,[' Blck ' int2str(j) ':\n']);
|
||||
for i=1:length(ix2(1,:))
|
||||
fprintf(fidlog,[' params:' int2str(i) ': ' num2str(ix2(j,i)) '\n']);
|
||||
|
@ -103,6 +106,7 @@ if ~options_.load_mh_file & ~options_.mh_recover
|
|||
j = j+1;
|
||||
validate = 1;
|
||||
end
|
||||
end
|
||||
init_iter = init_iter + 1;
|
||||
if init_iter > 100 & validate == 0
|
||||
disp(['MH: I couldn''t get a valid initial value in 100 trials.'])
|
||||
|
|
Loading…
Reference in New Issue