def reversehot(arr):
    """
    Function to reverse the one hot transformation.
    """
    if len(arr.shape) > 1:
        if len(arr.shape) == 2:
            if arr.shape[0] == 1:
                return arr[(0), :]
            if arr.shape[1] == 1:
                return arr[:, (0)]
        return arr.argmax(axis=1)
    return arr
