import keras
# -*- encoding:utf-8 -*-
import numpy as np
from keras.models import Sequential
from keras.layers import Dense,Dropout
import random
from keras.models import load_model

lines = []
def read_data(path):
    with open(path) as f:
        for line in f.readlines():
            lines.append(eval(line.strip()))

    size = len(lines[0])
    train_x=[s[:size - 2] for s in lines]
    train_y=[s[size-1] for s in lines]
    return np.array(train_x),np.array(train_y)

# test_x,test_y=read_data("D:\\data\\quantization\\stock_test.log")
test_x,test_y=read_data("D:\\data\\quantization\\s\\stock_2020-01-07.log")

path="model_seq.h5"
model=load_model(path)
# score = model.evaluate(test_x, test_y)
# print(score)

result=model.predict(test_x)
# print(result)
i = 0
for x in result:
    # print(str(i) + ":" + str(x))
    if x[0] > 0.8:
        print(lines[i][-2], x, 1)
    # elif x[0] + x[1] > 0.9:
    #     print(lines[i][-2], x, 2)
    i = i + 1