scikit learn - NaiveBayes classifier handling different data types in python -


i trying implement naive bayes classifier in python. attributes of different data types : strings, int, float, boolean, ordinal

i use gaussian naive bayes classifier (sklearn.naivebayes : python package) , not know how different data types handled. classifier throws error, stating cannot handle data types other int or float

one way possibly think of encoding strings numerical values. doubt , how classifier perform if this.

yes, need convert strings numerical values naive bayes classifier can not handle strings there not way string can enter in mathematical equation.

if strings have "scalar value" example "large, medium, small" might want classify them "3,2,1", however, if strings things without order such colours or names, can or assign binary variables every variable referring colour or name, if not many.

for example if classifying cars can red blue , green can define variables 'red' 'blue' 'green' take values 0/1, depending on colour of car.


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -

jdbc - Not able to establish database connection in eclipse -