Пример #1
0
def split_ds_train_test(supervised):
    size_supervised = len(supervised)
    global split_train_test
    split_train_test = int(size_supervised * config.train_rate)
    train, test = supervised[0:split_train_test], supervised[split_train_test:]
    # transform the scale of the data
    scaler, train_scaled, test_scaled = data_misc.scale(train, test)
    x_train, y_train = train_scaled[:, 0:-1], train_scaled[:, -1]
    x_test, y_test = test_scaled[:, 0:-1], test_scaled[:, -1]
    return scaler, x_train, y_train, x_test, y_test
Пример #2
0
def split_ds_train_val_test(supervised):
    size_supervised = len(supervised)
    global split_train_val
    split_train_val = int(size_supervised * config.train_val_rate)
    global split_val_test
    split_val_test = int(size_supervised * config.val_test_rate)
    global split_train_test
    split_train_test = split_train_val + split_val_test
    train = supervised[0:split_train_val]
    val = supervised[split_train_val:split_train_val + split_val_test]
    test = supervised[split_train_val + split_val_test:]

    # transform the scale of the data
    scaler, train_scaled, val_scaled = data_misc.scale(train, val)
    scaler, train_scaled, test_scaled = data_misc.scale(train, test)

    #print(val[:, -1])
    x_train, y_train = train_scaled[:, 0:-1], train_scaled[:, -1]
    x_val, y_val = val_scaled[:, 0:-1], val_scaled[:, -1]
    x_test, y_test = test_scaled[:, 0:-1], test_scaled[:, -1]

    return scaler, x_train, y_train, x_val, y_val, x_test, y_test
Пример #3
0
            df_trend[column] = series[column]

        trend_supervised = supervised_diff_dt(df_trend, window_size_trend)

        # we cut according to the biggest window size
        trend_supervised = trend_supervised[total_window_size:, :]

        # Concatenate with numpy
        supervised = np.concatenate((trend_supervised, supervised), axis=1)

    # Supervised reffers either avg_supervised or the combination of avg_supervised with bitcoin_values.
    size_supervised = len(supervised)
    split = int(size_supervised * 0.80)
    train, test = supervised[0:split], supervised[split:]
    # transform the scale of the data
    scaler, train_scaled, test_scaled = data_misc.scale(train, test)
    x_train, y_train = train_scaled[:, 0:-1], train_scaled[:, -1]
    x_test, y_test = test_scaled[:, 0:-1], test_scaled[:, -1]

    total_features = len(train[0])
    print('Total Features: %i' % (total_features))
    print('Total of supervised data: %i' % (size_supervised))

    print(':: Train ::')
    len_y_train = len(y_train)
    # No Prediction
    y_predicted_es = y_train
    rmse, y_predicted = compare_train(len_y_train, y_predicted_es)
    normal_train_results.append(rmse)
    corr_normal_train_results.append(
        data_misc.correlation(y_train, y_predicted))