Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Major] increase default batch size (deleted) #1460

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions neuralprophet/configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,15 +158,15 @@ def set_quantiles(self):
def set_auto_batch_epoch(
self,
n_data: int,
min_batch: int = 16,
max_batch: int = 512,
min_batch: int = 32,
max_batch: int = 1024,
min_epoch: int = 10,
max_epoch: int = 1000,
):
assert n_data >= 1
self.n_data = n_data
if self.batch_size is None:
self.batch_size = int(2 ** (2 + int(np.log10(n_data))))
self.batch_size = int(2 ** (3 + int(np.log10(n_data))))
self.batch_size = min(max_batch, max(min_batch, self.batch_size))
self.batch_size = min(self.n_data, self.batch_size)
log.info(f"Auto-set batch_size to {self.batch_size}")
Expand Down
12 changes: 6 additions & 6 deletions tests/test_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,12 @@ def test_auto_batch_epoch():
check = {
"1": (1, 1000),
"10": (10, 1000),
"100": (16, 539),
"1000": (32, 194),
"10000": (64, 103),
"100000": (128, 57),
"1000000": (256, 32),
"10000000": (512, 18),
"100": (32, 539),
"1000": (64, 194),
"10000": (128, 103),
"100000": (256, 57),
"1000000": (512, 32),
"10000000": (1024, 18),
}

for n_data, (batch_size, epochs) in check.items():
Expand Down
Loading