Skip to content

Commit 6372e61

Browse files
committed
Improve documentation for Trainer
1 parent e9b84c8 commit 6372e61

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

bayesflow/trainers.py

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,28 +57,39 @@ class Trainer:
5757
5858
- Online training
5959
Usage:
60-
>>> trainer.train_online(self, epochs, iterations_per_epoch, batch_size, **kwargs)
60+
>>> trainer.train_online(epochs, iterations_per_epoch, batch_size, **kwargs)
6161
6262
This training regime is optimal for fast generative models which can efficiently simulated data on-the-fly.
6363
In order for this training regime to be efficient, on-the-fly batch simulations should not take longer than 2-3 seconds.
64-
65-
Important: overfitting presents a danger when using a small simulated data set, so it is recommended to use
66-
some amount of regularization for the neural amortizer.
64+
65+
- Experience replay training
66+
Usage:
67+
>>> trainer.train_experience_replay(epochs, iterations_per_epoch, batch_size, **kwargs)
68+
69+
This training regime is also good for fast generative models capable of efficiently simulating data on-the-fly.
70+
Compare to pure online training, this training will keep an `experience replay` buffer from which simulations
71+
are randomly sampled, so the networks will likely see some simulations multiple times.
6772
6873
- Round-based training
6974
Usage:
70-
>>> trainer.train_rounds(self, rounds, sim_per_round, epochs, batch_size, **kwargs)
75+
>>> trainer.train_rounds(rounds, sim_per_round, epochs, batch_size, **kwargs)
7176
7277
This training regime is optimal for slow, but still reasonably performant generative models.
7378
In order for this training regime to be efficient, on-the-fly batch simulations should not take longer than one 2-3 minutes.
7479
80+
Important: overfitting presents a danger when using small numbers of simulated data sets, so it is recommended to use
81+
some amount of regularization for the neural amortizer(s).
82+
7583
- Offline taining
7684
Usage:
77-
>>> trainer.train_offline(self, simulations_dict, epochs, batch_size, **kwargs)
85+
>>> trainer.train_offline(simulations_dict, epochs, batch_size, **kwargs)
7886
7987
This training regime is optimal for very slow, external simulators, which take several minutes for a single simulation.
8088
It assumes that all training data has been already simulated and stored on disk.
81-
89+
90+
Important: overfitting presents a danger when using a small simulated data set, so it is recommended to use
91+
some amount of regularization for the neural amortizer(s).
92+
8293
Note: For extremely slow simulators (i.e., more than an hour of a single simulation), the BayesFlow framework
8394
might not be the ideal choice and should probably be considered in combination with a black-box surrogate optimization method,
8495
such as Bayesian optimization.

0 commit comments

Comments
 (0)