Skip to content

Commit

Permalink
simplify show_batch() text, add testing session for mercari databunch
Browse files Browse the repository at this point in the history
  • Loading branch information
quantran committed Apr 8, 2019
1 parent 9a780bf commit 2f20743
Show file tree
Hide file tree
Showing 2 changed files with 597 additions and 166 deletions.
13 changes: 8 additions & 5 deletions fastai_tab_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,13 +220,16 @@ def show_xys(self, xs, ys) -> None:
display(HTML('TEXT:<br>'))
names = ['text', 'target']
items = []
max_len = 70
for i, (x,y) in enumerate(zip(xs,ys)):
res = []
res.append(' '.join([ f'{tok}({self.vocab.stoi[tok]})'
for tok in x.text.split() if (not self.vocab.stoi[tok] == self.pad_idx) ]))
txt_x = x.text
items.append([txt_x, y])
# res = []
# res.append(' '.join([ f'{tok}({self.vocab.stoi[tok]})'
# for tok in x.text.split() if (not self.vocab.stoi[tok] == self.pad_idx) ]))

res.append(str(y))
items.append(res)
# res.append(str(y))
# items.append(res)

items = np.array(items)
df = pd.DataFrame({n:items[:,i] for i,n in enumerate(names)})
Expand Down
Loading

0 comments on commit 2f20743

Please sign in to comment.