Skip to content

Commit

Permalink
Add generator to keras_model.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Dhvani Patel committed Jul 17, 2017
1 parent 90d696c commit 3079b35
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 2 deletions.
Binary file modified __pycache__/toCheck.pypy-41.pyc
Binary file not shown.
45 changes: 43 additions & 2 deletions keras_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,28 @@
# So 15 of 4 of one window
# One 4:
# [Good, Insert, Delete, Sub]
# WINDOW SIZE = 10
WINDOW_SIZE = 10


def firstTen(goodArr, insArr, delArr, subArr):
windowInd = 0
while windowInd < int(len(insArr)/10):
toPass = []
for x in range(10):
y = x + windowInd
toPass.append(goodArr[y])
for x in range(10):
y = x + windowInd
toPass.append(insArr[y])
for x in range(10):
y = x + windowInd
toPass.append(delArr[y])
for x in range(10):
y = x + windowInd
toPass.append(subArr[y])
#print len(toPass)
yield toPass
windowInd += 1

def chunker(seq, size):
return (seq[pos:pos + size] for pos in xrange(0, len(seq), size))
Expand All @@ -38,6 +59,26 @@ def create_batches():
one_hot_good, one_hot_bad_ins, one_hot_bad_del, one_hot_bad_sub, one_hot_good_out, one_hot_bad_ins_out, one_hot_bad_del_out, one_hot_bad_sub_out = perform()
print "Finished..."

firstTenGG = firstTen(one_hot_good, one_hot_bad_ins, one_hot_bad_del, one_hot_bad_sub)
firstTenBG = firstTen(one_hot_good_out, one_hot_bad_ins_out, one_hot_bad_del_out, one_hot_bad_sub_out)

inputTenG = []
outputTenB = []
for wow in firstTenGG:
inputTenG.append(wow)
for woh in firstTenBG:
outputTenB.append(woh)
print len(inputTenG)
print len(outputTenB)

print len(inputTenG[0][0])
print len(inputTenG[0])

print len(outputTenB[0][0])
print len(outputTenB[0])


'''
ohg_g = chunker(one_hot_good, 10)
ohbi_g = chunker(one_hot_bad_ins, 10)
ohbd_g = chunker(one_hot_bad_del, 10)
Expand Down Expand Up @@ -73,7 +114,7 @@ def create_batches():
temp = np.insert(subA, np.arange(len(delA)), delA)
temp2 = np.insert(temp, np.arange(len(insA)), insA)
train_input = np.insert(temp2, np.arange(len(goodA)), goodA)

'''
# feedData(train_input

#return train_input, train_output
Expand Down
Binary file modified py_mutations_hub.pyc
Binary file not shown.

0 comments on commit 3079b35

Please sign in to comment.