squareplus activation function use case squareplus designed to enhance positive values and suppress negative values for more detailed information you can refer to the following link https en wikipedia orgwikirectifierneuralnetworkssquareplus implements the squareplus activation function parameters vector np ndarray the input array for the squareplus activation beta float size of the curved region returns np ndarray the input array after applying the squareplus activation formula fx x sqrtx2 b 2 examples squareplusnp array2 3 0 6 2 3 8 beta2 array2 5 1 06811457 0 22474487 0 12731349 squareplusnp array9 2 0 3 0 45 4 56 beta3 array0 0808119 0 72891979 1 11977651 0 15893419 implements the squareplus activation function parameters vector np ndarray the input array for the squareplus activation beta float size of the curved region returns np ndarray the input array after applying the squareplus activation formula f x x sqrt x 2 b 2 examples squareplus np array 2 3 0 6 2 3 8 beta 2 array 2 5 1 06811457 0 22474487 0 12731349 squareplus np array 9 2 0 3 0 45 4 56 beta 3 array 0 0808119 0 72891979 1 11977651 0 15893419
import numpy as np


def squareplus(vector: np.ndarray, beta: float) -> np.ndarray:
    
    return (vector + np.sqrt(vector**2 + beta)) / 2


if __name__ == "__main__":
    import doctest

    doctest.testmod()