

def one_hot(X, n=None, negative_class=0.0):
    X = np.asarray(X).flatten()
    if (n is None):
        n = (np.max(X) + 1)
    Xoh = (np.ones((len(X), n)) * negative_class)
    Xoh[(np.arange(len(X)), X)] = 1.0
    return Xoh

dataset/ETHPy150Open IndicoDataSolutions/Foxhound/foxhound/preprocessing.py one_hot/original