bgd.batch module
This module contains all the different batching methods
that are implemented. Any new batching method needs to inherit
from bgd.batch.Batching
and to implement its abstract
methods (_start
and next
).
- class bgd.batch.Batching[source]
Bases:
object
Base class for generating batches.
- warm
Whether a dataset has been passed to the batching algorithm. Once it is warm, method ‘next’ can be called to retrieve a batch.
- Type
bool
- abstract _next()[source]
Wrapped method for retrieving a batch from the provided dataset. Subclasses must override this method.
- abstract _start(X, y)[source]
Wrapped method for providing a dataset to the batching algorithm. Subclasses must override this method.
- class bgd.batch.SGDBatching(batch_size, shuffle=True)[source]
Bases:
bgd.batch.Batching
Stochastic Gradient Descent Batching algorithm.
- Parameters
batch_size (int) – Size of each random batch.
shuffle (bool) – Whether to shuffle the dataset before extracting a batch from it.
- _next()[source]
Retrieves next batch using a generator function.
- Returns
- X (
np.ndarray
): Batch samples.
- y (
np.ndarray
): Batch target values.
- X (