Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

after predict, it is not integers result, how to output integers? #262

Open
hoyeunglee opened this issue Oct 1, 2018 · 0 comments
Open

Comments

@hoyeunglee
Copy link

from seq2seq import SimpleSeq2Seq, Seq2Seq, AttentionSeq2Seq
import os
import csv
import sys
import logging
import time

input_dim=1
input_length=6
hidden_dim=10
output_length=6
output_dim=1
depth=4
models = []
model = Seq2Seq(output_dim=output_dim, hidden_dim=hidden_dim, output_length=output_length, input_shape=(input_length, input_dim))
#models += [Seq2Seq(output_dim=output_dim, hidden_dim=hidden_dim, output_length=output_length, input_shape=(input_length, input_dim), peek=True)]
#models += [Seq2Seq(output_dim=output_dim, hidden_dim=hidden_dim, output_length=output_length, input_shape=(input_length, input_dim), depth=2)]
#models += [Seq2Seq(output_dim=output_dim, hidden_dim=hidden_dim, output_length=output_length, input_shape=(input_length, input_dim), peek=True, depth=2)]

model.compile(loss='mse', optimizer='sgd')


y = []
x = []
with open('./Mark Six.csv', 'rt') as csvfile:
    reader = csv.DictReader(csvfile)
    count = 1
    for row in reader:
        if count <= 1626:
            x = x + [[[int(row['Winning Number 1'].strip())],[int(row['2'].strip())],[int(row['3'].strip())],[int(row['4'].strip())],[int(row['5'].strip())],[int(row['6'].strip())]]]
        count = count + 1

with open('./Mark Six.csv', 'rt') as csvfile:
    reader = csv.DictReader(csvfile)
    count = 1
    for row in reader:
        if count > 1 and count <= 1627:
            y = y + [[[int(row['Winning Number 1'].strip())],[int(row['2'].strip())],[int(row['3'].strip())],[int(row['4'].strip())],[int(row['5'].strip())],[int(row['6'].strip())]]]
        count = count + 1

model.fit(np.array(x), np.array(y), epochs=1)
#model = Seq2Seq(output_dim=output_dim, hidden_dim=hidden_dim, output_length=output_length, input_shape=(input_length, input_dim), peek=True, depth=2, teacher_force=True)
#model.compile(loss='mse', optimizer='sgd')
#model.fit([np.array(x), np.array(y)], np.array(y), epochs=1)

x_test = []
with open('./Mark Six.csv', 'rt') as csvfile:
    reader = csv.DictReader(csvfile)
    count = 1
    for row in reader:
        if count > 1627-2:
            x_test = x_test + [[[int(row['Winning Number 1'].strip())],[int(row['2'].strip())],[int(row['3'].strip())],[int(row['4'].strip())],[int(row['5'].strip())],[int(row['6'].strip())]]]
        count = count + 1

y_test = []
with open('./Mark Six.csv', 'rt') as csvfile:
    reader = csv.DictReader(csvfile)
    count = 1
    for row in reader:
        if count > 1627-2:
            y_test = y_test + [[[int(row['Winning Number 1'].strip())],[int(row['2'].strip())],[int(row['3'].strip())],[int(row['4'].strip())],[int(row['5'].strip())],[int(row['6'].strip())]]]
        count = count + 1

model.predict(np.array([x_test[3]]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant