I was able to create and export a model to predict positive/negatives reviews.
Now I would like to use the same model to classify all observations on a .csv as “negatives” or “posivites”. The cvs look like this:
Is it possible to use fastai to create a fourth colum with the label corresponding to each observation?
I would really appreciate any guidance to start, because my fisrt try was:
and it did not work
From your first screenshot, the output of predict is a tuple with three values. And you only need the label, which is the first value of the tuple, to be added.
To do this, you can loop through the column values of observation, pass it through predict and isolate only the first entry with something like this:
Once done you can cast the final list of labels to pandas series and concatenate that to the original dataframe.
Done I used a list comprehension for that, here is the solution: