Effacer les filtres
Effacer les filtres

Naive Bayes Classification for categorical values

2 vues (au cours des 30 derniers jours)
Ege
Ege le 25 Nov 2014
Commenté : Ege le 4 Jan 2015
Hi, I have a dataset containing numerical and categorical data. I like to use Naive Bayes Classifier in the following link but it only confers with numerical values.
Does anyone have an idea about how to extend that code to categorical data as well?

Réponse acceptée

Sean de Wolski
Sean de Wolski le 25 Nov 2014
Convert the categoricals to doubles.
c = categorical({'red';'blue';'red'})
double(c)
  4 commentaires
Sean de Wolski
Sean de Wolski le 26 Nov 2014
The table is nice for storing but not for these computations. Reconvert to a table after with the same names from the original table (T.properties.variableNames).
Ege
Ege le 4 Jan 2015
Hi i just realized that converting categorical to double makes things complicated. For example it gives different values to the ones that are actually same. I see values 127 ,96 all sort of different ones in a column where all of them were actually 'yes'. So what should I do about it?

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by