amices / mice

Multivariate Imputation by Chained Equations
https://amices.org/mice/
GNU General Public License v2.0
428 stars 107 forks source link

Add a progress bar for better time management #565

Open vkhodygo opened 1 year ago

vkhodygo commented 1 year ago

Is your feature request related to a problem? Please describe. I usually have no idea how much time an imputation might take.

Describe the solution you'd like Add a progress bar & ETA to futuremice/mice.

Describe alternatives you've considered Run a timing routine for one iteration and multiply by the total number of iterations.

stefvanbuuren commented 1 year ago

The suggestion makes sense. I assume it should only show when interactive() is TRUE. I usually look at the speed on the printed log to make an estimate, but that works only because I know the algorithm.

One iteration should give a pretty good idea how long the total process may take. For a non-parallel mice() just multiply the time maxit m. If the total is below 5 seconds, don't show at all. Predicted time in futuremice() may be a little more complicated to calculate though.

Anyone willing to look into this?

vkhodygo commented 1 year ago

when interactive() is TRUE

Not necessarily, since we know in advance how many iterations maxit and imputations m we need we can calculate the total number that is maxit * m. Now, an indicator that goes to stdout tells you how much time has passed/how far the imputation has progressed.

One iteration should give a pretty good idea how long the total process may take.

That's what I usually do, but when you run multiple calculations at once it's difficult to keep all these times in mind.

stefvanbuuren commented 1 year ago

Related #551

isaactpetersen commented 1 year ago

I have the same feature request: https://github.com/amices/mice/issues/516

thomvolker commented 1 year ago

I have time to look into this sometime soon, but the main problem for implementing this is that futuremice is essentially a wrapper around mice, and all calculations occur within mice calls. Ergo, the progress bar would be a part of the mice() call itself, through an implementation that is also compatible with futuremice().