Skip to content

Commit

Permalink
Faster preprocess (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
tushuhei authored May 12, 2022
1 parent 7d9c2b1 commit 572ec50
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions scripts/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,9 @@ def preprocess(

for i, entry in enumerate(entries):
Y[i] = entry[0] == '1'
for col in entry[1:]:
if col in feature_index:
X[i, feature_index[col]] = True
X[i, -1] = True # add a bias column.
indices = [feature_index[col] for col in entry[1:] if col in feature_index]
X[i, indices] = True
X[:, -1] = True # add a bias column.
return X, Y, features


Expand Down

0 comments on commit 572ec50

Please sign in to comment.