add_function
add_function(function)Defines a global function which can be used by all neurons and synapses.
The function must have only one return value and use only the passed arguments.
Examples of valid functions:
ann.add_function('logistic(x) = 1 / (1 + exp(-x))')
ann.add_function('''
piecewise(x, a, b) = if x < a:
a
else:
if x > b :
b
else:
x
''')Please refer to the manual to know the allowed mathematical functions.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| function | str | (multi)string representing the function. | required |