The aim of Data visualization is some what different for classification as compared to the regression , in classification we have to find how different attributes (numeric and categorical ) are related to categorical labels or we can say with different categories of labels.
>>following are some techniques used for Data visualization for classification ----
- Visualize class separation using numeric feature ---- goal of visualizing data for classification is to understand which feature is useful for class separation. we can use bar plot for this purpose see .. that above code demonstrate how we can plot box plot with different features on x axis and label which is bad credit in this case on y axis . num_col is a list of numeric columns of dataframe named as credit.
- Visualizing class separation using categorical features----- Now its time to visualize ability of categorical features to classify labels. best way to do this is bar plot.above code shows how you can draw bar plot side by side for each category for each categorical feature. first this code declares a list of categorical columns or features. then it creates new columns named dummy to keep count of each category . then we use for loop to loop over each categorical columns in dataset . after that we use groupby operation to group data by label( in this case"bad_credit") and count number of observations in each group using count method immediately after groupby operation. then we created a figure and filterd data frame for bad_credit having value 0. and created subplot . similarly we do for bad_credit having value 1 and plot bar plot.
Comments
Post a Comment