Most references I find say that the activation function used in nnet is 'usually' a logistic function. But in the case that I would like to test the performance of the trained neural network from nnet, it is necessary to know the exact activation function used.


1 Answer 1


This is the implemented function (extracted from the C-sources; filennet.c, lines 156-165):

static double
sigmoid(double sum)
    if (sum < -15.0)
    return (0.0);
    else if (sum > 15.0)
    return (1.0);
    return (1.0 / (1.0 + exp(-sum)));
  • $\begingroup$ Wonder why there is -15/15 limit, it is because it is faster to check for this condition than calculate exp(15)? $\endgroup$ Feb 27, 2015 at 21:32
  • $\begingroup$ 1 / (1 + exp(- (15))) is approx 0.999999694 and 1 / (1 + exp(-(-15))) is approx. 0.000000306 so they just choose to take the error. 15 seems pretty arbitrary, but fair. $\endgroup$
    – Jon
    Nov 18, 2016 at 3:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.