Beispiel #1
0
results = provider.balance_result(result_cols[0], low, high, step, samples)
results = results[result_cols].as_matrix()
results = results[:, 0]
data = provider.fetch_dataset(data_segment)

# results = results * 0.1
# data = data[:10000]
# results = results[:10000]

count = data.shape[0]

[training_data, training_result], \
[validation_data, validation_result], \
[test_data, test_result], \
    = provider.balance_dataset([results, data], low, high, step,
                               validation_samples_ratio=0.05,
                               test_samples_ratio=0.05)

print(("Total data set size: {}\n"
       "Training set size: {}\n"
       "Validation set size: {}\n"
       "Test set size: {}\n".format(count, training_data.shape[0],
                                    validation_data.shape[0],
                                    test_data.shape[0])))

print(
    ("training result max:{} min:{}".format(round(np.max(training_result), 2),
                                            round(np.min(training_result)),
                                            2)))

model.train([training_data, training_result],
result_cols = ['nextday_close']

provider = Provider(start_date, end_date)
model = Model()

results = provider.fetch_resultset(result_cols)
results = provider.balance_result(result_cols[0], low, high, step, samples)
results = results[result_cols].as_matrix()
results = results[:, 0]
data = provider.fetch_dataset(data_segment)

# results = results * 0.1
# data = data[:10000]
# results = results[:10000]

count = data.shape[0]

[training_data, training_result], \
[validation_data, validation_result], \
[test_data, test_result], \
    = provider.balance_dataset([results, data], low, high, step, 250, 200)

print(("Training set size: {}\n"
       "Validation set size: {}\n"
       "Test set size: {}\n".format(training_data.shape[0],
                                    validation_data.shape[0],
                                    test_data.shape[0])))

model.train([training_data, training_result],
            [validation_data, validation_result], [test_data, test_result])