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

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -