bgd.initializers module

This module contains contains all the initializers that are implemented. Any new initializer needs to inherit from bgd.initializers.Initializer and to implement its abstract methods (_initialize).

class bgd.initializers.GaussianInitializer(mean, stdv, truncated=False, seed=None)[source]

Bases: bgd.initializers.Initializer

Initializer for generating arrays using a Gaussian distribution.

Parameters
  • mean (float) – Mean of the Gaussian distribution.

  • stdv (float) – Standard deviation of the Gaussian distribution.

  • truncated (bool) – Whether to truncate the sampled values.

  • seed (int) – Seed for the random number generator.

class bgd.initializers.GlorotGaussianInitializer(seed=None)[source]

Bases: bgd.initializers.Initializer

Initializer for generating arrays using a Glorot Gaussian distribution.

Parameters

seed (int) – Seed for the random number generator

class bgd.initializers.GlorotUniformInitializer(seed=None)[source]

Bases: bgd.initializers.Initializer

Initializer for generating arrays using a Glorot uniform distribution.

Parameters

seed (int) – Seed for the random number generator.

class bgd.initializers.Initializer(seed=None)[source]

Bases: object

Base class for all initializers.

Parameters

seed (int) – Seed for the random number generator.

initialize(shape, dtype=<class 'numpy.float32'>)[source]

Return array with random values. The distribution of the values is defined in subclasses.

Parameters
  • shape (tuple) – Shape of the array to be initialized.

  • dtype (np.dtype) – Data type of the array to be initialized.

Returns

An array of provided shape initialized accordingly.

Return type

np.ndarray

class bgd.initializers.UniformInitializer(min_value=- 0.05, max_value=0.05, seed=None)[source]

Bases: bgd.initializers.Initializer

Initializer for generating arrays using a uniform distribution.

Parameters
  • min_value (float) – Lower bound of the uniform distribution.

  • max_value (float) – Upper bound of the uniform distribution.

  • seed (int) – Seed for the random number generator.

class bgd.initializers.ZeroInitializer[source]

Bases: bgd.initializers.Initializer

Initializer for generating arrays of zeroes.

Parameters

seed (int) – Seed for the random number generator.