neupy.init module

class neupy.init.Initializer[source]

Base class for parameter initialization.

Methods

sample(shape, return_array=False) Returns tensorflow’s tensor or numpy array with specified shape. Type of the object depends on the return_array value. Numpy array will be returned when return_array=True and tensor otherwise.
inherit_method_docs = True[source]
sample(shape, return_array=False)[source]

Returns tensorflow’s tensor with specified shape.

Parameters:
shape : tuple

Parameter shape.

return_array : bool

Returns numpy’s array when equal to True and tensorflow’s tensor when equal to False. Defaults to False.

Returns:
array-like or Tensor
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, return_array=False) Returns tensorflow’s tensor or numpy array with specified shape. Type of the object depends on the return_array value. Numpy array will be returned when return_array=True and tensor otherwise.
sample(shape, return_array=False)[source]

Returns tensorflow’s tensor with specified shape.

Parameters:
shape : tuple

Parameter shape.

return_array : bool

Returns numpy’s array when equal to True and tensorflow’s tensor when equal to False. Defaults to False.

Returns:
array-like or Tensor
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.

seed : None or int

Random seed. Integer value will make results reproducible. Defaults to None.

Methods

sample(shape, return_array=False) Returns tensorflow’s tensor or numpy array with specified shape. Type of the object depends on the return_array value. Numpy array will be returned when return_array=True and tensor otherwise.
sample(shape, return_array=False)[source]

Returns tensorflow’s tensor with specified shape.

Parameters:
shape : tuple

Parameter shape.

return_array : bool

Returns numpy’s array when equal to True and tensorflow’s tensor when equal to False. Defaults to False.

Returns:
array-like or Tensor
class neupy.init.Uniform[source]

Initialize parameter sampling from the uniform distribution.

Parameters:
minval : int, float

Minimum possible value.

maxval : int, float

Maximum possible value.

seed : None or int

Random seed. Integer value will make results reproducible. Defaults to None.

Methods

sample(shape, return_array=False) Returns tensorflow’s tensor or numpy array with specified shape. Type of the object depends on the return_array value. Numpy array will be returned when return_array=True and tensor otherwise.
sample(shape, return_array=False)[source]

Returns tensorflow’s tensor with specified shape.

Parameters:
shape : tuple

Parameter shape.

return_array : bool

Returns numpy’s array when equal to True and tensorflow’s tensor when equal to False. Defaults to False.

Returns:
array-like or Tensor
class neupy.init.Orthogonal[source]

Initialize matrix with orthogonal basis.

Parameters:
scale : int, float

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

seed : None or int

Random seed. Integer value will make results reproducible. Defaults to None.

Raises:
ValueError

In case if tensor shape has more than 2 dimensions.

Methods

sample(shape, return_array=False) Returns tensorflow’s tensor or numpy array with specified shape. Type of the object depends on the return_array value. Numpy array will be returned when return_array=True and tensor otherwise.
sample(shape, return_array=False)[source]

Returns tensorflow’s tensor with specified shape.

Parameters:
shape : tuple

Parameter shape.

return_array : bool

Returns numpy’s array when equal to True and tensorflow’s tensor when equal to False. Defaults to False.

Returns:
array-like or Tensor
class neupy.init.HeNormal[source]

Kaiming He parameter initialization method based on the normal distribution.

Parameters:
gain : float

Scales variance of the distribution by this factor. Value 2 is a suitable choice for layers that have Relu non-linearity. Defaults to 1.

seed : None or int

Random seed. Integer value will make results reproducible. Defaults to None.

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, return_array=False) Returns tensorflow’s tensor or numpy array with specified shape. Type of the object depends on the return_array value. Numpy array will be returned when return_array=True and tensor otherwise.
sample(shape, return_array=False)[source]

Returns tensorflow’s tensor with specified shape.

Parameters:
shape : tuple

Parameter shape.

return_array : bool

Returns numpy’s array when equal to True and tensorflow’s tensor when equal to False. Defaults to False.

Returns:
array-like or Tensor
class neupy.init.HeUniform[source]

Kaiming He parameter initialization method based on the uniformal distribution.

Parameters:
gain : float

Scales variance of the distribution by this factor. Value 2 is a suitable choice for layers that have Relu non-linearity. Defaults to 1.

seed : None or int

Random seed. Integer value will make results reproducible. Defaults to None.

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, return_array=False) Returns tensorflow’s tensor or numpy array with specified shape. Type of the object depends on the return_array value. Numpy array will be returned when return_array=True and tensor otherwise.
sample(shape, return_array=False)[source]

Returns tensorflow’s tensor with specified shape.

Parameters:
shape : tuple

Parameter shape.

return_array : bool

Returns numpy’s array when equal to True and tensorflow’s tensor when equal to False. Defaults to False.

Returns:
array-like or Tensor
class neupy.init.XavierNormal[source]

Xavier Glorot parameter initialization method based on normal distribution.

Parameters:
gain : float

Scales variance of the distribution by this factor. Value 2 is a suitable choice for layers that have Relu non-linearity. Defaults to 1.

seed : None or int

Random seed. Integer value will make results reproducible. Defaults to None.

References

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

Methods

sample(shape, return_array=False) Returns tensorflow’s tensor or numpy array with specified shape. Type of the object depends on the return_array value. Numpy array will be returned when return_array=True and tensor otherwise.
sample(shape, return_array=False)[source]

Returns tensorflow’s tensor with specified shape.

Parameters:
shape : tuple

Parameter shape.

return_array : bool

Returns numpy’s array when equal to True and tensorflow’s tensor when equal to False. Defaults to False.

Returns:
array-like or Tensor
class neupy.init.XavierUniform[source]

Xavier Glorot parameter initialization method based on uniform distribution.

Parameters:
gain : float

Scales variance of the distribution by this factor. Value 2 is a suitable choice for layers that have Relu non-linearity. Defaults to 1.

seed : None or int

Random seed. Integer value will make results reproducible. Defaults to None.

References

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

Methods

sample(shape, return_array=False) Returns tensorflow’s tensor or numpy array with specified shape. Type of the object depends on the return_array value. Numpy array will be returned when return_array=True and tensor otherwise.
sample(shape, return_array=False)[source]

Returns tensorflow’s tensor with specified shape.

Parameters:
shape : tuple

Parameter shape.

return_array : bool

Returns numpy’s array when equal to True and tensorflow’s tensor when equal to False. Defaults to False.

Returns:
array-like or Tensor