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

eachbatch maxsize could use some more options #61

@bhvieira

Description

@bhvieira

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions