Xavier

class ampligraph.latent_features.Xavier(initializer_params={}, verbose=True, seed=0)

Follows the xavier strategy for initialization of layers [GB10].

If uniform is set to True, then it initializes the layer from the following uniform distribution:

\[\mathcal{U} ( - \sqrt{ \frac{6}{ fan_{in} + fan_{out} } }, \sqrt{ \frac{6}{ fan_{in} + fan_{out} } } )\]

If uniform is False, then it initializes the layer from the following normal distribution:

\[\mathcal{N} ( 0, \sqrt{ \frac{2}{ fan_{in} + fan_{out} } } )\]

where \(fan_{in}\) and \(fan_{out}\) are number of input units and output units of the layer respectively.

Methods

__init__([initializer_params, verbose, seed]) Initialize the Xavier strategy
__init__(initializer_params={}, verbose=True, seed=0)

Initialize the Xavier strategy

Parameters:
  • initializer_params (dict) –

    Consists of key-value pairs. The initializer will check the keys to get the corresponding params:

    • uniform: (bool). indicates whether to use Xavier Uniform or Xavier Normal initializer.

    Example: initializer_params={'uniform': False}

  • verbose (bool) – Enable/disable verbose mode
  • seed (int/np.random.RandomState) – random state for random number generator