Learn R Programming

nnetpredint (version 1.2)

activate:

Neuron Activation Function

Description

activation function for each neuron node, we provide the popular activation functions including 'sigmoid', 'tanh', etc.

Usage

activate(x, funName)

Arguments

x

input value to the activation function

funName

This package provides the most popular activation functions which can be used by setting the funName parameter to the following strings: 'sigmoid', 'tanh'.

'sigmoid' sigmoid function 1/(1 + exp(-x)).

'tanh' tanh is the hyperbolic tangent function equal to (exp(x) - exp(-x)) / (exp(x) + exp(-x)).

Examples

Run this code
x <- c(-5:5)
y1 <- activate(x, funName = 'sigmoid')
y2 <- activate(x, funName = 'tanh')

Run the code above in your browser using DataLab