Skip to content

Commit

Permalink
Convert floats one_hots into ints
Browse files Browse the repository at this point in the history
  • Loading branch information
Dhvani Patel committed Jul 17, 2017
1 parent 3079b35 commit 321fb06
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
Binary file modified __pycache__/toCheck.pypy-41.pyc
Binary file not shown.
16 changes: 11 additions & 5 deletions keras_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,14 @@
# [Good, Insert, Delete, Sub]
WINDOW_SIZE = 10

# DEFINED:

def firstTen(goodArr, insArr, delArr, subArr):
# FIXED INPUT BITS = 87 (ONE TOKEN)
# FIXED OUTPUT BITS = 102 (2+2+3+10+85)
# WINDOW = 10, SO BATCH = 40 INPUT, 40 OUTPUT


def getTen(goodArr, insArr, delArr, subArr):
windowInd = 0
while windowInd < int(len(insArr)/10):
toPass = []
Expand All @@ -36,7 +42,7 @@ def firstTen(goodArr, insArr, delArr, subArr):
#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 @@ -54,13 +60,13 @@ def __getitem__(self,idx):
batch_y = self.y[idx*self.batch_size:(idx+1)*self.batch_size]
return np.array([batch_x]), np.array(batch_y)

'''
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)
firstTenGG = getTen(one_hot_good, one_hot_bad_ins, one_hot_bad_del, one_hot_bad_sub)
firstTenBG = getTen(one_hot_good_out, one_hot_bad_ins_out, one_hot_bad_del_out, one_hot_bad_sub_out)

inputTenG = []
outputTenB = []
Expand Down
7 changes: 7 additions & 0 deletions py_mutations_hub.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ def one_hot(indexed_tokens):
nb_classes = 87
one_hot_targets = np.eye(nb_classes)[indexed_tokens]
one_hot = one_hot_targets.tolist()
print "fort"
#bruhTemp = one_hot[:]
for x in range(len(one_hot)):
#one_hot[x].astype(int)
[int(i) for i in one_hot[x]]
#one_hot.astype(int)
print type(one_hot[0][0])
return one_hot


Expand Down
Binary file modified py_mutations_hub.pyc
Binary file not shown.

0 comments on commit 321fb06

Please sign in to comment.