pcarbo / varbvs

Large-scale Bayesian variable selection for R and MATLAB.
http://pcarbo.github.io/varbvs
GNU General Public License v3.0
42 stars 14 forks source link

Inf is not allowed for options.maxiter #8

Closed xiangzhu closed 8 years ago

xiangzhu commented 8 years ago

It seems that we have to set up a finite maximum number of iterations in varbvs 2.0.

I tried to set options.maxiter=Inf, and I got the following error:

Error using zeros
NaN and Inf not allowed.

Error in varbvsnorm (line 59)
  logw = zeros(1,maxiter);

Error in varbvs>outerloop (line 801)
    [logw err sigma sa alpha mu s] = ...

Error in varbvs (line 701)
        [logw(i) sigma(i) sa(i) alpha(:,i) mu(:,i) s(:,i) eta(:,i) ...

I guess a simple workaround can be setting options.maxiter as extremely large number, to mimic Inf.

pcarbo commented 8 years ago

I prefer not to allow maxiter = Inf because I don't want the algorithm to run forever. :) Thanks for pointing that out. I've added a check to 'varbvs' for maxiter being finite. Let me know if you notice any other small problems like that.