deepnetts.net.layers.activation

## Interface ActivationFunction

• All Known Implementing Classes:
LeakyRelu, Linear, Relu, Sigmoid, Tanh

`public interface ActivationFunction`
Common base interface for all activation functions used in layers. Classes implementing this interface should provide methods for calculating value and first derivative of the activation function. Activation function performs non-linear transformation of its input before its sent to layer output. First derivative of a function shows how fast and in what direction function is changing if its input changes, and it is used by training algorithm. For more see https://en.wikipedia.org/wiki/Activation_function
Author:
Zoran Sevarac
`ActivationType`
• ### Method Summary

All Methods
Modifier and Type Method and Description
`void` ```apply(Tensor tensor, int channel)```
`void` ```apply(Tensor tensor, int from, int to)```
`static ActivationFunction` `create(ActivationType type)`
Creates and returns specified type of activation function.
`float` `getPrime(float y)`
Returns the first derivative of activation function for specified output y
`float` `getValue(float x)`
Returns the value of activation function for specified input x
• ### Method Detail

• #### getValue

`float getValue(float x)`
Returns the value of activation function for specified input x
Parameters:
`x` - input for activation
Returns:
value of activation function
• #### apply

```void apply(Tensor tensor,
int channel)```
• #### apply

```void apply(Tensor tensor,
int from,
int to)```
• #### getPrime

`float getPrime(float y)`
Returns the first derivative of activation function for specified output y
Parameters:
`y` - output of activation function
Returns:
first derivative of activation function
• #### create

`static ActivationFunction create(ActivationType type)`
Creates and returns specified type of activation function. A factory method for creating activation functions;
Parameters:
`type` - type of the activation function
Returns:
returns instance of specified activation function type