predict-coin/predict.py

37 lines
1.0 KiB
Python

import numpy
from keras.models import load_model
from data import load_pay_data, load_gift_data
import matplotlib.pyplot as plt
# x_train, y_train, tx_train, ty_train, _ = load_pay_data(160)
# model = load_model("./predict_pay")
# p_data = model.predict(tx_train)
# for i in range(len(p_data)):
# comp = (p_data[i][0] - ty_train[i]) / ty_train[i]
# print(comp, p_data[i][0], ty_train[i])
# if abs(comp) >= 1:
# print("测结果:", p_data[i][0], "测:", tx_train[i], "真实:", ty_train[i])
x_train, y_train, tx_train, ty_train, _ = load_gift_data(160)
model = load_model("./predict_gift")
p_data = model.predict(tx_train)
for i in range(len(p_data)):
comp = (p_data[i][0] - ty_train[i]) / ty_train[i]
print(comp, p_data[i][0], ty_train[i])
if abs(comp) >= 0.1:
print("测结果:", p_data[i][0], "测:", tx_train[i], "真实:", ty_train[i])
plt.plot(ty_train)
plt.plot(p_data)
plt.show()
# data = numpy.reshape([[15, 2359688 / 10000000, 255968 / 1000000, 10 / 10000]],(1, 4, 1))
# print( model.predict(data))