I have a data base with categorical values, and i'm trying to use the feature selection based on mutual information. And just in the beggining i'm getting this error:
ValueError: could not convert string to float: 'Mr. Michael Hall'
`
This was what I am trying to do:
from sklearn.feature_selection import mutual_info_classif
mutual_info = mutual_info_classif(X_train_cat, y_train)
Does anyone know why this is gaving me this error?
You are getting this error because it expects a float data type. Float data type contains value like
1.00,2.21,3.14,1234.42132,12413.1241413...and so on.Data which you are passing is of type string.
To get mutual information you need to pass float data type instead of string.
To know more about mutual information
In order for us to help you more please give us sample dataset.