Skip to contents

Exponential Linear Unit (ELU) Activation Function

Usage

ELU(x, alpha = 1)

Arguments

x

A numeric vector. All elements must be finite and non-missing.

alpha

A numeric scalar. All elements must be finite and non-missing.

Value

A numeric vector where the ReLU function has been applied to each element of x.

See also

Other Activation Functions: GELU(), PReLU(), ReLU(), SELU(), Swish(), dELU(), dGELU(), dPReLU(), dReLU(), dSELU(), dSwish(), dlReLU(), dsoftplus(), lReLU(), softplus()

Author

Matthew Fidler

Examples


ELU(c(-1, 0, 1, 2), 2)
#> [1] -1.264241  0.000000  1.000000  2.000000

# Can also be used in rxode2:
x <- rxode2({
   r=SELU(time)
})
#>  
#>  
#> using C compiler: ‘gcc (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0’

e <- et(c(-1, 0, 1, 2))

rxSolve(x, e)
#> Warning: 
#> with negative times, compartments initialize at first negative observed time
#> with positive times, compartments initialize at time zero
#> use 'rxSetIni0(FALSE)' to initialize at first observed time
#> this warning is displayed once per session
#> ── Solved rxode2 object ──
#> ── Parameters (value$params): ──
#> # A tibble: 1 × 0
#> ── Initial Conditions (value$inits): ──
#> named numeric(0)
#> ── First part of data (object): ──
#> # A tibble: 4 × 2
#>    time     r
#>   <dbl> <dbl>
#> 1    -1 -1.11
#> 2     0  0   
#> 3     1  1.05
#> 4     2  2.10