Search code examples
pythonscikit-learnnlp

scikit-learn LogisticRegression Classify another value


i'm new to python and have to make a natural language processing task. Using a kaggle dataset a sentiment classify should be implemented using python. For this i'm using a dataframe and the LogisticRegression, as described in this article and everythin works fine.

Now i want to know if it is possible to classify another string which is not in the dataset, so that i can experiment with the classifier interactively.

Is this possible? Thank you!


Solution

  • You will have to manually run all the preprocessing on youur new data, than predict.

    That is:

    So first (Data Cleaning) and other functions which you've called which edit the data,
    then run the (Create a bag of words) part, and only
    Then use the fitted LR model to predict on this (preprocessed) data.