Ok, forget about copying the dataframe. I was applying the predict method to the entire dataframe instead of the text column which yield some weird resultsâ€¦

However, I still get different classes and probabilities when applying predict() and get_preds() to the test dataframe. Here is a minimal example based on the IMDB text classification tutorial. Itâ€™s not supposed to classify well, just a quick and light-weight way to replicate the issue.

Am I missing something essential, or are these two methods even supposed to return the same results?

```
from fastai.text import *
path = untar_data(URLs.IMDB_SAMPLE)
data = pd.read_csv(path/'texts.csv')
train_data = data.sample(150, random_state=42)
valid_data = data.drop(train_data.index).sample(50, random_state=42)
test_data = data.drop(train_data.index.append(valid_data.index)).sample(50, random_state=42)
data_lm = TextLMDataBunch.from_df(path, train_df=train_data, valid_df=valid_data)
data_clas = TextClasDataBunch.from_df(path, train_df=train_data, valid_df=valid_data, test_df=test_data, bs=4, vocab=data_lm.vocab)
learn = language_model_learner(data_lm, drop_mult=0.5, pretrained_model=URLs.WT103)
learn.fit_one_cycle(1, 1e-2)
learn.unfreeze()
learn.fit_one_cycle(1, 1e-3)
learn.save_encoder('encoder')
classifier = text_classifier_learner(data_clas, drop_mult=0.2)
classifier.load_encoder('encoder')
classifier.fit_one_cycle(1, 1e-2)
classifier.freeze_to(-2)
classifier.fit_one_cycle(1, slice(5e-3/2., 5e-3))
classifier.unfreeze()
classifier.fit_one_cycle(3, slice(2e-3/100, 2e-3))
classifier.save('classifier')
pred, _ = classifier.get_preds(DatasetType.Test, ordered=True)
preds_prob, preds_class = pred.max(1)
predict_df = test_data.text.apply(classifier.predict)
predict_df_class = [x[0].obj for x in predict_df.values]
predict_df_prob = [max(x[2].tolist()) for x in predict_df.values]
print(preds_class[:10])
print(predict_df_class[:10])
print(preds_prob[:10])
print(predict_df_prob[:10])
sample_nr = 5
sample_text = test_data.iloc[sample_nr].text
print(classifier.predict(sample_text))
print('{}, {}'.format(preds_class[sample_nr], pred[sample_nr]))
```