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