Skip to content
This repository has been archived by the owner on May 21, 2022. It is now read-only.

eachbatch maxsize could use some more options #61

Open
bhvieira opened this issue Sep 8, 2021 · 0 comments
Open

eachbatch maxsize could use some more options #61

bhvieira opened this issue Sep 8, 2021 · 0 comments

Comments

@bhvieira
Copy link

bhvieira commented Sep 8, 2021

The arg maxsize was added to eachbatch in #9 (in response to #8).
I believe eachbatch could use one more optional argument: zero_remainder.

If you set maxsize and zero_remainder = true, then you get the current behavior.
If you set maxsize and zero_remainder = false, then you get batches of size maxsize, no observations are ignored if the total size is not dividable by maxsize, but the last batch contains the remaining observations, even if only one.

This is useful in two regards: some people will define minibatches like that, and explicitly have batches with different numbers of observations; the number of obs per batch does not change (with the exception of the last one, of course), and you still use all obs, this could help regarding code optimization.

Also, not gonna lie, when I saw maxsize I intuitively thought it had the behavior I described above.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant