Noise layers¶

Noise layers

 Dropout Dropout layer
class braid.berry.layers.Dropout(incoming, p, **kwargs)

Dropout layer

Sets values to zero with probability p. See notes for disabling dropout during testing.

incoming
: a Layer instance or a tuple
the layer feeding into this layer, or the expected input shape
p
: float, optional (default = 0.5)
The probability of setting a value to zero
name
: string, optional (default = None)
Name of the layer. Should be specified for better readability ( inherited from Layer).

Note

The dropout layer is a regularizer that randomly sets input values to zero; see [1], [2] for why this might improve generalization.

For ease of use, see get_aux_inputs() to get the value of p during training and testing.

 [1] Hinton, G., Srivastava, N., Krizhevsky, A., Sutskever, I., Salakhutdinov, R. R. (2012): Improving neural networks by preventing co-adaptation of feature detectors. arXiv preprint arXiv:1207.0580.
 [2] Srivastava Nitish, Hinton, G., Krizhevsky, A., Sutskever, I., & Salakhutdinov, R. R. (2014): Dropout: A Simple Way to Prevent Neural Networks from Overfitting. Journal of Machine Learning Research, 5(Jun)(2), 1929-1958.
get_aux_inputs()

This function returns the auxiliary inputs required for the layer.

list of tuples
[(tf.placeholder.name, (train_phase_value, test_phase_value)),]
>>> l = Dropout(l_in, p=0.5)
>>> print l.get_aux_inputs()
[(u'drop_1/p:0', (0.5, 1.0))]

get_fan_out()

Output receptive field

int
fan_in * p
get_output_for()

Perform the dropout operation and returns the output tf.Tensor

tf.Tensor
Output tensor of this layer.
get_output_shape_for(input_shape)

Shape of the output tensor

input_shape
: tuple or list
Shape of the input layer.
tuple
Same as the input_shape
validate_input_layer(incoming)

Validate the input layer shape

Returns True if the input layer is 2D else, raise an exceptions.AssertError.