# Transfer neuron activation def transfer(activation): return 1.0 / (1.0 + exp(-activation)) # Calculate the derivative of an neuron output def transfer_derivative(output): return output * (1.0 - output)