import numpy as np
from enum import Enum


""" All the activation functions available (feel free to add more) """


def identity(val):
    return val


def binarystep(val):
    return (0 if val < 0 else 1)


def sigmoid(val, activationResponse=1/4.924273):
    return 1 / (1 + np.exp(-(val/activationResponse)))


def tanh(val):
    return np.tanh(val)


def relu(val):
    return np.maximum(0, val)


def leakyrelu(val):
    return (val*0.01 if val < 0 else val)


def absval(val):
    return abs(val)


def gaussian(val):
    return np.exp(-(val**2))


def arctan(val):
    return np.arctan(val)


def sine(val):
    return np.sin(val)


def cosine(val):
    return np.cos(val)


class ActivationFunctions(Enum):
    IDENTITY = identity
    BINARYSTEP = binarystep
    SIGMOID = sigmoid
    TANH = tanh
    RELU = relu
    LEAKYRELU = leakyrelu
    ABSVAL = absval
    GAUSSIAN = gaussian
    ARCTAN = arctan
    SINE = sine
    COSINE = cosine

