Exemplo n.º 1
0
def getData(X_train, fn, noisepct):
    """
    TODO use eval or something to make this less noisy
    """
    from apprentice import testData
    if fn == "f1":
        Y_train = [testData.f1(x) for x in X_train]
    elif fn == "f2":
        Y_train = [testData.f2(x) for x in X_train]
    elif fn == "f3":
        Y_train = [testData.f3(x) for x in X_train]
    elif fn == "f4":
        Y_train = [testData.f4(x) for x in X_train]
    elif fn == "f5":
        Y_train = [testData.f5(x) for x in X_train]
    elif fn == "f6":
        Y_train = [testData.f6(x) for x in X_train]
    elif fn == "f7":
        Y_train = [testData.f7(x) for x in X_train]
    elif fn == "f8":
        Y_train = [testData.f8(x) for x in X_train]
    elif fn == "f9":
        Y_train = [testData.f9(x) for x in X_train]
    elif fn == "f10":
        Y_train = [testData.f10(x) for x in X_train]
    elif fn == "f12":
        Y_train = [testData.f12(x) for x in X_train]
    elif fn == "f13":
        Y_train = [testData.f13(x) for x in X_train]
    elif fn == "f14":
        Y_train = [testData.f14(x) for x in X_train]
    elif fn == "f15":
        Y_train = [testData.f15(x) for x in X_train]
    elif fn == "f16":
        Y_train = [testData.f16(x) for x in X_train]
    elif fn == "f17":
        Y_train = [testData.f17(x) for x in X_train]
    elif fn == "f18":
        Y_train = [testData.f18(x) for x in X_train]
    elif fn == "f19":
        Y_train = [testData.f19(x) for x in X_train]
    elif fn == "f20":
        Y_train = [testData.f20(x) for x in X_train]
    elif fn == "f21":
        Y_train = [testData.f21(x) for x in X_train]
    elif fn == "f22":
        Y_train = [testData.f22(x) for x in X_train]
    elif fn == "f23":
        Y_train = [testData.f23(x) for x in X_train]
    elif fn == "f24":
        Y_train = [testData.f24(x) for x in X_train]
    else:
        raise Exception("function {} not implemented, exiting".format(fn))

    # stdnormalnoise = np.zeros(shape = (len(Y_train)), dtype =np.float64)
    # for i in range(len(Y_train)):
    #     stdnormalnoise[i] = np.random.normal(0,1)

    # return np.atleast_2d(np.array(Y_train)*(1+ noisepct*stdnormalnoise))
    return Y_train
Exemplo n.º 2
0
def getData(X_train, fn, noisepct):
    """
    TODO use eval or something to make this less noisy
    """
    from apprentice import testData
    if fn==1:
        Y_train = [testData.f1(x) for x in X_train]
    elif fn==2:
        Y_train = [testData.f2(x) for x in X_train]
    elif fn==3:
        Y_train = [testData.f3(x) for x in X_train]
    elif fn==4:
        Y_train = [testData.f4(x) for x in X_train]
    elif fn==5:
        Y_train = [testData.f5(x) for x in X_train]
    elif fn==6:
        Y_train = [testData.f6(x) for x in X_train]
    elif fn==7:
        Y_train = [testData.f7(x) for x in X_train]
    elif fn==8:
        Y_train = [testData.f8(x) for x in X_train]
    elif fn==9:
        Y_train = [testData.f9(x) for x in X_train]
    elif fn==10:
        Y_train = [testData.f10(x) for x in X_train]
    elif fn==12:
        Y_train = [testData.f12(x) for x in X_train]
    elif fn==13:
        Y_train = [testData.f13(x) for x in X_train]
    elif fn==14:
        Y_train = [testData.f14(x) for x in X_train]
    elif fn==15:
        Y_train = [testData.f15(x) for x in X_train]
    elif fn==16:
        Y_train = [testData.f16(x) for x in X_train]
    elif fn==17:
        Y_train = [testData.f17(x) for x in X_train]
    elif fn==18:
        Y_train = [testData.f18(x) for x in X_train]
    elif fn==19:
        Y_train = [testData.f19(x) for x in X_train]
    elif fn==20:
        Y_train = [testData.f20(x) for x in X_train]
    elif fn==21:
        Y_train = [testData.f21(x) for x in X_train]
    elif fn==22:
        Y_train = [testData.f22(x) for x in X_train]
    elif fn==23:
        Y_train = [testData.f23(x) for x in X_train]
    elif fn==24:
        Y_train = [testData.f24(x) for x in X_train]
    else:
        raise Exception("function {} not implemented, exiting".format(fn))

    stdnormalnoise = np.zeros(shape = (len(Y_train)), dtype =np.float64)
    for i in range(len(Y_train)):
        stdnormalnoise[i] = np.random.normal(0,1)

    return np.atleast_2d(np.array(Y_train)*(1+ noisepct*stdnormalnoise))
Exemplo n.º 3
0
def getData(X_train, fn, noisepct):
    """
    TODO use eval or something to make this less noisy
    """
    from apprentice import testData
    if fn == "f1":
        Y_train = [testData.f1(x) for x in X_train]
    elif fn == "f2":
        Y_train = [testData.f2(x) for x in X_train]
    elif fn == "f3":
        Y_train = [testData.f3(x) for x in X_train]
    elif fn == "f4":
        Y_train = [testData.f4(x) for x in X_train]
    elif fn == "f5":
        Y_train = [testData.f5(x) for x in X_train]
    elif fn == "f6":
        Y_train = [testData.f6(x) for x in X_train]
    elif fn == "f7":
        Y_train = [testData.f7(x) for x in X_train]
    elif fn == "f8":
        Y_train = [testData.f8(x) for x in X_train]
    elif fn == "f9":
        Y_train = [testData.f9(x) for x in X_train]
    elif fn == "f10":
        Y_train = [testData.f10(x) for x in X_train]
    elif fn == "f12":
        Y_train = [testData.f12(x) for x in X_train]
    elif fn == "f13":
        Y_train = [testData.f13(x) for x in X_train]
    elif fn == "f14":
        Y_train = [testData.f14(x) for x in X_train]
    elif fn == "f15":
        Y_train = [testData.f15(x) for x in X_train]
    elif fn == "f16":
        Y_train = [testData.f16(x) for x in X_train]
    elif fn == "f17":
        Y_train = [testData.f17(x) for x in X_train]
    elif fn == "f18":
        Y_train = [testData.f18(x) for x in X_train]
    elif fn == "f19":
        Y_train = [testData.f19(x) for x in X_train]
    elif fn == "f20":
        Y_train = [testData.f20(x) for x in X_train]
    elif fn == "f21":
        Y_train = [testData.f21(x) for x in X_train]
    elif fn == "f22":
        Y_train = [testData.f22(x) for x in X_train]
    elif fn == "f23":
        Y_train = [testData.f23(x) for x in X_train]
    elif fn == "f24":
        Y_train = [testData.f24(x) for x in X_train]
    else:
        raise Exception("function {} not implemented, exiting".format(fn))
    return Y_train