Saturday, 15 December 2018

Filling the missing values of categorical varables

Categorical variables:

Categorical variables are those which take limited or fixed number of values and assign the values to the category to which it fits best. For example If there are 5 categories in a variable then the values of the variable ranges from 0 to 4.


Fixing missing numerical values:

To fix missing numerical values we can do pd.dropna() in python which removes the missing value arrays. But this makes the data to loose its information which may help in accurate predictions. So we fill the missing values by available methods. One method is Enumerate method, in this method the missing values are filled with mean or median but sometimes it is better to fill the values based on the near values this can be achieved by interpolation method. All the libraries are available in python.


Fixing the missing categorical values:

When we try to fill the categorical values the fill methods take averages and specific calculation which may not fill with a integer values. the methods explained above mostly gives a float values as output.

Hence to overcome this problem we use K-Nearest Neighbors methods to fill the categorical values.
This method fits the KNN algorithm to the available values and assigns the missing value to the category predicted by it.

The program and explanation in python is there in the below link

No comments:

Post a Comment

Filling the missing values of categorical varables

Categorical variables: Categorical variables are those which take limited or fixed number of values and assign the values to the catego...