gov.sandia.cognition.learning.function.scalar

## Class LeakyRectifiedLinearFunction

• All Implemented Interfaces:
Evaluator<java.lang.Double,java.lang.Double>, DifferentiableEvaluator<java.lang.Double,java.lang.Double,java.lang.Double>, DifferentiableUnivariateScalarFunction, ScalarFunction<java.lang.Double>, UnivariateScalarFunction, CloneableSerializable, java.io.Serializable, java.lang.Cloneable

```@PublicationReference(author="Wikipedia",
title="Rectifier",
type=WebPage,
year=2014,
url="http://en.wikipedia.org/wiki/Rectifier_(neural_networks)")
public class LeakyRectifiedLinearFunction
extends AbstractDifferentiableUnivariateScalarFunction```
A leaky rectified linear unit. For a value greater than 0, the function just returns the value. For a value less than or equal to zero, it returns the leakage (usually a small value, like 0.01) times the input. Its derivative is 1 for values greater than 0 and the leakage value for those less than 0. Although the derivative is ill-defined at 0 itself, the implementation treats the derivative at 0 as the amount of leakage. It is typically useful for handling the vanishing gradient problem. If no leakage is used, then the standard `RectifiedLinearFunction` can be used instead. Also, if the leakage is 1, then a `IdentityScalarFunction` could be used.
Since:
3.4.0
Author:
Justin Basilico
`RectifiedLinearFunction`, Serialized Form
• ### Field Summary

Fields
Modifier and Type Field and Description
`static double` `DEFAULT_LEAKAGE`
The default leakage is 0.01.
`protected double` `leakage`
The amount of leakage for when the value is less than zero.
• ### Method Summary

All Methods
Modifier and Type Method and Description
`LeakyRectifiedLinearFunction` `clone()`
This makes public the clone method on the `Object` class and removes the exception that it throws.
`double` `differentiate(double input)`
Differentiates the output of the function about the given input
`double` `evaluate(double input)`
Produces a double output for the given double input
`double` `getLeakage()`
Sets the leakage, which is the multiplier for the value when it is less than zero.
`void` `setLeakage(double leakage)`
Sets the leakage, which is the multiplier for the value when it is less than zero.
• ### Methods inherited from class java.lang.Object

`equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
• ### Methods inherited from interface gov.sandia.cognition.math.DifferentiableUnivariateScalarFunction

`differentiate`
• ### Methods inherited from interface gov.sandia.cognition.math.UnivariateScalarFunction

`evaluate, evaluateAsDouble`
• ### Field Detail

• #### DEFAULT_LEAKAGE

`public static final double DEFAULT_LEAKAGE`
The default leakage is 0.01.
Constant Field Values
• #### leakage

`protected double leakage`
The amount of leakage for when the value is less than zero.
• ### Constructor Detail

• #### LeakyRectifiedLinearFunction

`public LeakyRectifiedLinearFunction(double leakage)`
Creates a new `LeakyRectifiedLinearFunction` with the given leakage.
Parameters:
`leakage` - The leakage amount. Must be between 0 and 1.
• ### Method Detail

• #### clone

`public LeakyRectifiedLinearFunction clone()`
Description copied from class: `AbstractCloneableSerializable`
This makes public the clone method on the `Object` class and removes the exception that it throws. Its default behavior is to automatically create a clone of the exact type of object that the clone is called on and to copy all primitives but to keep all references, which means it is a shallow copy. Extensions of this class may want to override this method (but call `super.clone()` to implement a "smart copy". That is, to target the most common use case for creating a copy of the object. Because of the default behavior being a shallow copy, extending classes only need to handle fields that need to have a deeper copy (or those that need to be reset). Some of the methods in `ObjectUtil` may be helpful in implementing a custom clone method. Note: The contract of this method is that you must use `super.clone()` as the basis for your implementation.
Specified by:
`clone` in interface `CloneableSerializable`
Overrides:
`clone` in class `AbstractCloneableSerializable`
Returns:
A clone of this object.
• #### evaluate

`public double evaluate(double input)`
Description copied from interface: `UnivariateScalarFunction`
Produces a double output for the given double input
Parameters:
`input` - Input to the Evaluator
Returns:
output at the given input
• #### differentiate

`public double differentiate(double input)`
Description copied from interface: `DifferentiableUnivariateScalarFunction`
Differentiates the output of the function about the given input
Parameters:
`input` - Input about which to compute the derivative of the function output
Returns:
Derivative of the output with respect to the input
• #### getLeakage

`public double getLeakage()`
Sets the leakage, which is the multiplier for the value when it is less than zero. It is usually a small value.
Returns:
The leakage amount. Must be between 0 and 1.
• #### setLeakage

`public void setLeakage(double leakage)`
Sets the leakage, which is the multiplier for the value when it is less than zero. It is usually a small value.
Parameters:
`leakage` - The leakage amount. Must be between 0 and 1.