Skip to content

Instantly share code, notes, and snippets.

View agastidukare's full-sized avatar

Agasti Kishor Dukare agastidukare

View GitHub Profile
learn.predict("I love traveling with Vistara Airways!!!! Awesome service.. Thank you!!")
pred_fwd,lbl_fwd = learn.get_preds(ordered=True)
accuracy(pred_fwd, lbl_fwd)
learn.fit_one_cycle(5, slice(1e-3/(2.6**4),1e-3), moms=(0.8,0.7))
learn.save('fwd_clas')
learn.unfreeze()
learn.lr_find()
learn.recorder.plot(skip_end=15)
learn.freeze_to(-3)
learn.fit_one_cycle(4, slice(5e-3/(2.6**4),5e-3), moms=(0.8,0.7))
learn.freeze_to(-2)
learn.fit_one_cycle(4, slice(1e-3/(2.6**4), 1e-3), moms=(0.8,0.7))
learn.fit_one_cycle(4, 5e-2, moms=(0.8,0.7))
learn.lr_find()
learn.recorder.plot(skip_end=15)
learn = text_classifier_learner(data_clas, AWD_LSTM, drop_mult=0.5)
learn.load_encoder('fine_tuned_enc')
data_clas = (TextList.from_csv(path, 'Tweets.csv', cols='text')
#Where are the text? Column 'text' of tweets.csv
.split_by_rand_pct(0.2)
#How to split it? Randomly with the default 20% in valid
.label_from_df(cols='airline_sentiment')
#specify the label column
.databunch(bs=48))
#Create databunch
data_clas.show_batch()