For some reason I do not understand, the function
get_posterior_parameters.m not only reads out the parameters to the function output
xparam, but also sets them in the global workspace. I do not really understand why. We call it for example in
evaluate_smoother.m in the context of
if ischar(parameters) switch parameters case 'posterior_mode' parameters = get_posterior_parameters('mode'); case 'posterior_mean' parameters = get_posterior_parameters('mean'); case 'prior_mode' parameters = bayestopt_.p5(:);
Note that in the
prior mode case, nothing in the base workspace is altered. As far as I can see, all calls to this function are followed by an explicit setting of the parameter via e.g.
The problem is that the setting of
M_.H in the function is wrong as correlations are treated as covariances and measurement errors are ignored. There are two ways out:
- Get rid of setting variables from the base workspace in the function, making the function read-only (as the name suggests)
- Fix the parts of the function setting the covariance matrices.
I would suggest to go for 1 as I cannot see a purpose of the parameter setting.