Skip to content

Commit

Permalink
Added keras_model.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Dhvani Patel committed Jul 13, 2017
1 parent 73e63e6 commit 4162624
Show file tree
Hide file tree
Showing 10 changed files with 52 additions and 8 deletions.
Binary file modified Token.pyc
Binary file not shown.
Binary file modified __pycache__/toCheck.pypy-41.pyc
Binary file not shown.
46 changes: 46 additions & 0 deletions keras_model.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Copyright 2017 Dhvani Patel

from keras.models import Sequential
from keras.layers import Dense, Dropout
import numpy
from Token import Token
from py_mutations_hub import perform

# BATCH = 60
# So 15 of 4 of one window
# One 4:
# [Good, Insert, Delete, Sub]
# WINDOW SIZE = 10

def create_batches():
# Copyright 2016, 2017 Eddie Antonio Santos <[email protected]>
"""
Return a tuple of infinite training and validation examples,
respectively.
"""
training = LoopBatchesEndlessly(
filehashes=self.training_set,
vectors_path=self.vectors_path,
batch_size=self.batch_size,
context_length=self.context_length,
backwards=self.backwards
)
validation = LoopBatchesEndlessly(
filehashes=self.validation_set,
vectors_path=self.vectors_path,
batch_size=self.batch_size,
context_length=self.context_length,
backwards=self.backwards
)
return training, validation

def initData():
print "Start..."
one_hot_all = perform()
print len(one_hot_all)

train_input, train_output = create_batches()


if __name__ == '__main__':
initData()
Binary file modified mutate_deletion.pyc
Binary file not shown.
Binary file modified mutate_insert.pyc
Binary file not shown.
Binary file modified mutate_token_delete.pyc
Binary file not shown.
Binary file modified mutate_token_insert.pyc
Binary file not shown.
Binary file modified mutate_token_sub.pyc
Binary file not shown.
14 changes: 6 additions & 8 deletions py_mutations_hub.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
from mutate_token_sub import subTokMut

# NUM TOTAL: 462 563
# ACTUAl: 462 561
# ACTUAL: 925 122, BATCH = 66, GOOD = 33, BAD = 33 (I, D, S -> 11)
# Iterations: 14 017
# Unused samples = 2
# ACTUAl: 462 540
# ACTUAL: 925 080, BATCH = 60, GOOD = 30, BAD = 30 (I, D, S -> 10)
# Iterations: 15 418
# Unused samples = 23
# ONE HOT = 87

BATCH_SIZE = 66
Expand Down Expand Up @@ -146,7 +146,7 @@ def handle_token(type, token, (srow, scol), (erow, ecol), line):
(srow, scol, erow, ecol, tokenize.tok_name[type], repr(token))


def testTime():
def perform():
sqlite_file = "/home/dhvani/python-sources.sqlite3"
conn = sqlite3.connect(sqlite_file)
c = conn.cursor()
Expand Down Expand Up @@ -203,13 +203,11 @@ def testTime():
#print one_hot_all[538]

print "SUCCESS"

return one_hot_all

else:
print "Try again..."

def perform():
testTime()

if __name__ == '__main__':
perform()
Expand Down
Binary file added py_mutations_hub.pyc
Binary file not shown.

0 comments on commit 4162624

Please sign in to comment.