Class Learner
from fastai.text import *
from sklearn.model_selection import train_test_splitCreating Databunches
We need to create databunches for both the language and classifcation model.
df = pd.read_csv(path/'train.csv', index_col=0)
train_df, valid_df = train_test_split(df, test_size=0.2)
data_lm = TextLMDataBunch.from_df(
path,
train_df=train_df,
valid_df=valid_df,
text_cols=[0, 2],
bs=32
)
data_class = TextClasDataBunch.from_df(
path,
train_df=train_df,
valid_df=valid_df,
vocab=data_lm.train_ds.vocab,
text_cols=[0, 2],
label_cols=1,
bs=32
)
data_class.show_batch() # sanity checkCreating/Training the Language Learner
Creating/Training the Classification Learner
Predictions
Last updated
Was this helpful?