Activation Functions#

custom_neural_net_creator.activation_functions#

custom_neural_net_creator.activation_functions.relu(x: ndarray[Any, dtype[_ScalarType_co]]) ndarray[Any, dtype[_ScalarType_co]]#

Calculate the ReLU (Rectified Linear Unit) activation function.

This function computes the ReLU activation function for the given input data x. The ReLU function is commonly used in neural networks and returns the maximum of 0 and the input value for each element of the input array. It effectively introduces non-linearity to the network.

Parameters:

x (npt.NDArray) – The input data.

Returns:

The output of the ReLU activation function.

Return type:

npt.NDArray

custom_neural_net_creator.activation_functions.relu_derivative(x: ndarray[Any, dtype[_ScalarType_co]]) ndarray[Any, dtype[_ScalarType_co]]#

Calculate the derivative of the ReLU (Rectified Linear Unit) activation function.

This function computes the derivative of the ReLU activation function for the given input data x. The ReLU derivative is used in backpropagation to calculate gradients during neural network training. It returns the result of the ReLU derivative applied to each element of the input array.

Parameters:

x (npt.NDArray) – The input data.

Returns:

The derivative of the ReLU activation function.

Return type:

npt.NDArray

custom_neural_net_creator.activation_functions.sigmoid(x: ndarray[Any, dtype[_ScalarType_co]]) ndarray[Any, dtype[_ScalarType_co]]#

Calculate the sigmoid activation function.

This function computes the sigmoid activation function for the given input data x. The sigmoid function maps input values to the range (0, 1), making it suitable for binary classification problems. It returns the result of the sigmoid activation applied to each element of the input array.

Parameters:

x (npt.NDArray) – The input data.

Returns:

The output of sigmoid activation function.

Return type:

npt.NDArray

custom_neural_net_creator.activation_functions.sigmoid_derivative(x: ndarray[Any, dtype[_ScalarType_co]]) ndarray[Any, dtype[_ScalarType_co]]#

Calculate the derivative of the sigmoid activation function.

This function computes the derivative of the sigmoid activation function for the given input data x. The sigmoid derivative is used in backpropagation to calculate gradients during neural network training. It returns the result of the sigmoid derivative applied to each element of the input array.

Parameters:

x (npt.NDArray) – The input data.

Returns:

The derivative of the sigmoid activation function.

Return type:

npt.NDArray

custom_neural_net_creator.activation_functions.tanh(x: ndarray[Any, dtype[_ScalarType_co]]) ndarray[Any, dtype[_ScalarType_co]]#

Calculate the hyperbolic tangent (tanh) activation function.

This function computes the hyperbolic tangent (tanh) activation function for the given input data x. The tanh function maps input values to the range (-1, 1) and is used in neural networks to introduce non-linearity. It returns the result of the tanh activation applied to each element of the input array.

Parameters:

x (npt.NDArray) – The input data.

Returns:

The output of the tanh activation function.

Return type:

npt.NDArray

custom_neural_net_creator.activation_functions.tanh_prime(x: ndarray[Any, dtype[_ScalarType_co]]) ndarray[Any, dtype[_ScalarType_co]]#

Calculate the derivative of the hyperbolic tangent (tanh) activation function.

This function computes the derivative of the hyperbolic tangent (tanh) activation function for the given input data x. The tanh derivative is used in backpropagation to calculate gradients during neural network training. It returns the result of the tanh derivative applied to each element of the input array.

Parameters:

x (npt.NDArray) – The input data.

Returns:

The derivative of the tanh activation function.

Return type:

npt.NDArray