this script demonstrates the implementation of the binary step function it s an activation function in which the neuron is activated if the input is positive or 0 else it is deactivated it s a simple activation function which is mentioned in this wikipedia article https en wikipedia orgwikiactivationfunction implements the binary step function parameters vector ndarray a vector that consists of numeric values returns vector ndarray input vector after applying binary step function vector np array1 2 0 2 1 45 3 7 0 3 binarystepvector array0 1 1 1 0 1 implements the binary step function parameters vector ndarray a vector that consists of numeric values returns vector ndarray input vector after applying binary step function vector np array 1 2 0 2 1 45 3 7 0 3 binary_step vector array 0 1 1 1 0 1
import numpy as np


def binary_step(vector: np.ndarray) -> np.ndarray:
    

    return np.where(vector >= 0, 1, 0)


if __name__ == "__main__":
    import doctest

    doctest.testmod()