title: Unable to encode user input values that is given to the loaded Naive Bayes model?
body: <p>I'm trying to get a prediction using a dataset that having string values using Naive Bayes classifier. the data set having 14 columns and 12 columns are having string values. </p>
  
  <p>I encoded the dataset using Labalencoder and onehot encoder and ready the dataset to use the Naive Bayes classifier. </p>
  
  <pre><code>dataset = pd.read_csv('D:\\\\CRC data set copies\\Testing1.csv')
  columns = ['Age', 'Weight', 'Gender', 'Ethnic_Group', 'Religion', 'Smoking', 'Alchohol', 'Maritial_Status', 'Family_History', 'District', 'Blood_in_stools', 'Abnormal_Stomach_pain', 'Weight_Loss', 'Tiredness']
  X = dataset[columns]
  y = dataset['Class']
  
  labelencoder_X = LabelEncoder()  # encoding the categorical variables
  # replacing the column0 categorical data with numeric values
  for col in columns[2:]:
      X[col] = labelencoder_X.fit_transform(X[col])
  
  onehotencoder = OneHotEncoder(categorical_features=[2,3,4,5,6,7,8,9,10,11,12,13])
  # creating new columns and representing true by 1
  X = onehotencoder.fit_transform(X).toarray()
  
  labelencoder_y = LabelEncoder()
  y = labelencoder_y.fit_transform(y)
  </code></pre>
  
  <p>then the model was created and saved.</p>
  
  <p>joblib.dump(model, 'model_joblib')</p>
  
  <pre><code># load the trained model using joblib
  load_model = joblib.load('model_joblib')
  
  predict = [[70,65,"M","b","s","Yes","Yes","MA","Y","kurunegala","P","P","P","P"]]
  predict = pd.DataFrame(predict,columns=columns)
  for col in columns[2:]:
      predict[col] = labelencoder_X.fit_transform(predict[col])
  predict = onehotencoder.transform(predict).toarray()
  print('\nNew predicted value: ', load_model.predict(predict))
  </code></pre>
  
  <p>I want to get user inputs and predict a result using the saved model of naive Bayes. I tried encoding the user input using same encoding way but now it's not encoding correctly as same as the dataset values. because of this, the prediction is wrong. </p>
  
  <p>Can someone help me to encode the user input values as the same values that the dataset has been encoded?</p>