Example #1
0
File: mlp.py Project: sdy99/PowerAI
def make_dataset(path, input_fmt, res_type):
    net_path = os.path.join(path, 'net')
    res_path = os.path.join(path, res_type)
    if not os.path.exists(res_path):
        os.mkdir(res_path)
    data_set = GHData(path, net_path, input_fmt)
    data_set.load_x(x_ratio_thr=-1.0, dt_idx=False)
    data_set.load_y(res_type, na_value=-1.0)
    # data_set.drop_times(['00000027'])
    data_set.normalize()
    # data_set.column_valid = np.ones((data_set.input_data.shape[1],), dtype=np.bool)
    data_set.save_data(res_path)
    return data_set
Example #2
0
def make_dataset(path, out_path, input_fmt, res_type):
    data_set = GHData(path, path + "/net", input_fmt)
    data_set.load_x()
    data_set.load_y(res_type)
    data_set.normalize()
    data_set.save_data(out_path)
Example #3
0
    res_type = 'cct'
    res_name = res_type
    res_path = path + "/" + res_name
    input_dic = {'generator': ['p', 'v'], 'station': ['pl', 'ql']}

    dr_percs = [0.5, 0.5, 0.5, 0.5, 0.5, 0.5]
    net_path = path + "/net"
    net = GHNet("inf", input_dic, dr_percs=dr_percs)
    net.load_net(net_path)
    net1 = GHNet("inf", input_dic, dr_percs=dr_percs)
    net1.load_net(net_path)

    data_set = GHData(path, net_path, net.input_layer)
    data_set.load_x(x_ratio_thr=-1.0)
    data_set.load_y(res_type)
    data_set.normalize()
    drops = np.array(range(len(data_set.column_valid)))[~data_set.column_valid]
    net.drop_inputs(drops)
    net1.drop_inputs(drops)

    n_batch = 16
    n_epochs = 10
    n_al_epochs = 10
    only_real = True
    y_columns = list(range(data_set.y.shape[1]))
    y_columns = [2, 11, 23]
    net.build_multi_reg_k(len(y_columns),
                          activation=tf.keras.layers.LeakyReLU())
    net1.build_multi_reg_k(len(y_columns),
                           activation=tf.keras.layers.LeakyReLU())
    data_set.split_dataset_random(train_perc=0.0,