Skip to content

Instantly share code, notes, and snippets.

Avatar

Nissan Dookeran nissan

View GitHub Profile
View Baseline.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nissan
nissan / predictions.py
Created Aug 27, 2018 — forked from lextoumbourou/predictions.py
Making predictions with a SequentialRNN model (Fast.ai)
View predictions.py
# Note: ensure you have the latest version of Torchtext by running: pip install torchtext --upgrade
rnn_model = text_data.get_model(opt_fn, 1500, bptt, emb_sz=em_sz, n_hid=nh, n_layers=nl,
dropout=0.1, dropouti=0.65, wdrop=0.5, dropoute=0.1, dropouth=0.3)
# ...
rnn_model.data.test_dl.src.sort = False
rnn_model.data.test_dl.src.sort_within_batch = False
rnn_model.data.test_dl.src.shuffle = False
@nissan
nissan / dataframe_dataset.py
Created Aug 27, 2018 — forked from lextoumbourou/dataframe_dataset.py
Torchtext dataset from DataFrame
View dataframe_dataset.py
from torchtext import data
class DataFrameDataset(data.Dataset):
def __init__(self, df, text_field, label_field, is_test=False, **kwargs):
fields = [('text', text_field), ('label', label_field)]
examples = []
for i, row in df.iterrows():
label = row.sentiment if not is_test else None
text = row.text