machine learning - String Data Training for KNN Classification : Python -


i have been trying learn train data i.e implement machine learning has string data. understand was, can convert string data type categorical, unable using labelencoder. , heard should not map data , change numerical data prediction wrong.

here example of data :

lp001002,male,no,0,graduate,no,5849,0,,360,1,urban,y lp001003,male,yes,1,graduate,no,4583,1508,128,360,1,rural,n lp001005,male,yes,0,graduate,yes,3000,0,66,360,1,urban,y lp001006,male,yes,0,not graduate,no,2583,2358,120,360,1,urban,y lp001008,male,no,0,graduate,no,6000,0,141,360,1,urban,y lp001011,male,yes,2,graduate,yes,5417,4196,267,360,1,urban,y 

as can see, gender (2), married(3),dependant(4),education(5),self_employed(6),property_area(11),loan_status(!2) string.

some of columns have missing data, unable use onehot encoder. error : unordered types str() > int()

i want convert categorical type , and use training model knn.i using python 3.6.

what want perform one-hot encoding, there function that:

http://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.onehotencoder.html


Comments

Popular posts from this blog

python - Selenium remoteWebDriver (& SauceLabs) Firefox moseMoveTo action exception -

html - How to custom Bootstrap grid height? -

transpose - Maple isnt executing function but prints function term -