2

I've been using MultinomialNB classifier from sklearn.naive_bayes library on vectorized text data.

make_pipeline(
            TfidfVectorizer(),
            MultinomialNB(
                alpha=0.1,
                fit_prior=True,
                class_prior=self.class_prior
            ),
        )

After some data preprocessing (lower text, stemming, stopwords removal,...) and training I'm saving the trained model into model.sav file for later prediction. I tried to train two models with same training data, saved in two different files. How is it possible, that the prediction results and probabilities for same input are different?

model 1 prediction

{
    "class": 2,
    "probability": 0.554312
}

model 2 prediction

{
    "class": 1,
    "probability": 0.530134
}

As I know, the MultinomialNB does not use any random state or seed or something, that could cause this, or does it?

hoodie_hxe
  • 21
  • 2

0 Answers0