neupy.init module

class neupy.init.Initializer[source]

Base class for parameter initialization.

Methods

sample(shape) Returns tensor with specified shape.
get_value()[source]

This method is the same as get_value for the Theano shared variables. The main point is to be able to generate understandable message when user try to get value from the uninitialized parameter.

inherit_method_docs = True[source]
sample(shape)[source]

Returns tensor with specified shape.

Parameters:

shape : tuple

Parameter shape.

Returns:

array-like

class neupy.init.Constant[source]

Initialize parameter that has constant values.

Parameters:

value : float, int

All parameters in the tensor will be equal to this value. Defaults to 0.

Methods

sample(shape) Returns tensor with specified shape.
sample(shape)[source]

Returns tensor with specified shape.

Parameters:

shape : tuple

Parameter shape.

Returns:

array-like

class neupy.init.Normal[source]

Initialize parameter sampling from the normal distribution.

Parameters:

mean : int, float

Mean of the normal distribution.

std : int, float

Standard deviation of the normal distribution.

Methods

sample(shape) Returns tensor with specified shape.
sample(shape)[source]

Returns tensor with specified shape.

Parameters:

shape : tuple

Parameter shape.

Returns:

array-like

class neupy.init.Uniform[source]

Initialize parameter sampling from the uniformal distribution.

Parameters:

minval : int, float

Minimum possible value.

maxval : int, float

Maximum possible value.

Methods

sample(shape) Returns tensor with specified shape.
sample(shape)[source]

Returns tensor with specified shape.

Parameters:

shape : tuple

Parameter shape.

Returns:

array-like

class neupy.init.Orthogonal[source]

Initialize matrix with orthogonal basis.

Parameters:

scale : int, float

Scales output matrix by a specified factor. Defaults to 1.

Raises:

ValueError

In case if tensor shape has more than 2 dimensions.

Methods

sample(shape) Returns tensor with specified shape.
sample(shape)[source]

Returns tensor with specified shape.

Parameters:

shape : tuple

Parameter shape.

Returns:

array-like

class neupy.init.HeNormal[source]

Kaiming He parameter initialization method based on the normal distribution.

Parameters:

gain : float or {relu}

Multiplies scaling factor by speified gain. The relu values set up gain equal to \(\sqrt{2}\). Defaults to 1.

References

[1] Kaiming He, Xiangyu Zhan, Shaoqing Ren, Jian Sun.
Delving Deep into Rectifiers: Surpassing Human-Level Performance on ImageNet Classification, 2015.

Methods

sample(shape) Returns tensor with specified shape.
sample(shape)[source]

Returns tensor with specified shape.

Parameters:

shape : tuple

Parameter shape.

Returns:

array-like

class neupy.init.HeUniform[source]

Kaiming He parameter initialization method based on the uniformal distribution.

Parameters:

gain : float or {relu}

Multiplies scaling factor by speified gain. The relu values set up gain equal to \(\sqrt{2}\). Defaults to 1.

References

[1] Kaiming He, Xiangyu Zhan, Shaoqing Ren, Jian Sun.
Delving Deep into Rectifiers: Surpassing Human-Level Performance on ImageNet Classification, 2015.

Methods

sample(shape) Returns tensor with specified shape.
sample(shape)[source]

Returns tensor with specified shape.

Parameters:

shape : tuple

Parameter shape.

Returns:

array-like

class neupy.init.XavierNormal[source]

Xavier Glorot parameter initialization method based on normal distribution.

Parameters:

gain : float or {relu}

Multiplies scaling factor by speified gain. The relu values set up gain equal to \(\sqrt{2}\). Defaults to 1.

References

[1] Xavier Glorot, Y Bengio. Understanding the difficulty
of training deep feedforward neural networks, 2010.

Methods

sample(shape) Returns tensor with specified shape.
sample(shape)[source]

Returns tensor with specified shape.

Parameters:

shape : tuple

Parameter shape.

Returns:

array-like

class neupy.init.XavierUniform[source]

Xavier Glorot parameter initialization method based on uniform distribution.

References

[1] Xavier Glorot, Y Bengio. Understanding the difficulty
of training deep feedforward neural networks, 2010.

Methods

sample(shape) Returns tensor with specified shape.
sample(shape)[source]

Returns tensor with specified shape.

Parameters:

shape : tuple

Parameter shape.

Returns:

array-like