The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.


AI::NNFlex::Mathlib - miscellaneous mathematical functions for the AI::NNFlex NN package


The AI::NNFlex::Mathlib package contains activation and error functions. At present there are the following:

Activation functions

  • tanh

  • linear

  • hopfield_threshold

Error functions

  • atanh

If you want to implement your own activation/error functions, you can add them to this module. All activation functions to be used by certain types of net (like Backprop) require an additional function <function name>_slope, which returns the 1st order derivative of the function.

This rule doesn't apply to all network types. Hopfield for example requires no slope calculation.


v1.2 includes hopfield_threshold


Copyright (c) 2004-2005 Charles Colbourn. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.