Example #1
0
# test_abnormal  = data_abnormal.drop(train_abnormal.index)
# x, y = train.iloc[:, :-1].values, train.iloc[:, -1].values.reshape(-1,1)
x, y = x_train.iloc[:, :].values, y_train.iloc[:, :].values.reshape(-1,1)
opts = {
    'min_samples':          0,
    'X':                    x, 
    'qd':                   4, 
    'max_depth':            10,
    'max_samples':      6000,
    'log':               True,
    'jump':              True,
    'reduce_branching':  True
}
root_region, gps_ = build_bins(**opts)
#root_region, gps_ = build(X=x, delta_divisor=3, max_depth=2)
root, gps, gps1, gps2        = structure(root_region, gp_types=['rbf'])  #modified



for i, gp in enumerate(gps):
    idx = query(x, gp.mins, gp.maxs)
    gp.x, gp.y = x[idx], y[idx]

    print(f"Training GP set1 {i+1}/{len(gps)} ({len(idx)})" #modified
    gp.init(cuda=True)

##modified
for i, gp in enumerate(gps1):
    idx = query(x, gp.mins, gp.maxs)
    gp.x, gp.y = x[idx], y[idx]
Example #2
0
test = data.drop(train.index)
x, y = train.iloc[:, :-1].values, train.iloc[:, -1].values.reshape(-1, 1)

opts = {
    'min_samples': 0,
    'X': x,
    'qd': 3,
    'max_depth': 2,
    'max_samples': 10**10,
    'log': True,
    'min_samples': 0,
    'jump': True,
    'reduce_branching': True
}
root_region, gps_ = build_bins(**opts)
root, gps = structure(root_region, gp_types=['rbf'])

for i, gp in enumerate(gps):
    idx = query(x, gp.mins, gp.maxs)
    gp.x, gp.y = x[idx], y[idx]
    print(f"Training GP {i+1}/{len(gps)} ({len(idx)})")
    gp.init(cuda=True)

root.update()

for smudge in np.arange(0, 0.5, 0.05):
    mu_s, cov_s = root.forward(test.iloc[:, 0:-1].values, smudge=smudge)
    mu_s = (mu_s.ravel() * dstd.iloc[-1]) + dmean.iloc[-1]
    mu_t = (test.iloc[:, -1] * dstd.iloc[-1]) + dmean.iloc[-1]
    sqe = (mu_s - mu_t.values)**2
    rmse = np.sqrt(sqe.sum() / len(test))
Example #3
0
for kkk in range(rerun):

    opts = {
        'min_samples': 0,
        'X': x,
        'qd': 9,
        'max_depth': 100,
        'max_samples': 5100,
        'log': True,
        'jump': True,
        'reduce_branching': True
    }
    root_region, gps_ = build_bins(**opts)

    root, gps = structure(root_region, gp_types=['matern1.5_ard'])  #modified

    rmse = 0
    mae = 0
    nlpd_all = []
    count = 0
    mid_LMM = np.zeros((y_d, epoch))
    for k in range(y_d):
        y_loop = y[:, k].reshape(-1, 1)
        # for i, gp in enumerate(gps):
        #     idx = query(x, gp.mins, gp.maxs)
        #     gp.x, gp.y = x[idx], y_loop[idx]
        #     print(f"Training GP set1 {i+1}/{len(gps)} ({len(idx)})") #modified
        #     gp.init(cuda=True)
        # lr = 0.1
        # steps = 200