I have a multi-class classification problem, and continuous features, I want to visualize using python libraries (matplotlib, seaborn, plotly..) the target variable ( 4 classes ) with each given feature.

I don't know which type of graph is more suitable for my case ( X_axis: 4 classes and Y_axis: given continuous feature ).

Please if you have any recommendations/examples/resources don't hesitate to share!


1 Answer 1


Before you think about visualization, you need to come up with the questions you would answer using visualization techniques.

1- For example, you could ask how is X feature different in different classes. Then you could plot the distribution of each feature (e.g. using a box plot with mean and median, one box per class, and one plot per feature) against each class (assuming you have limited number of features).

2- Another example, "How can we rank features in terms of their importance in the model?". Then you would be plotting feature importance as a bar graph, sorted from most important to least important. You could get the importance using a random forest classifier: documentation

3- You could project your features on a 2d plane, using UMAP or t-SNE for example, and scatter plot the projections while coloring each point with the class it belongs to. This will also show how "separable" the classes are given the features you are using.

4- You could plot a heat-map (4x4) of the mutual-information between the 4 classes, which can be computed through sklearn's function: documentation. I used that for example in this problem > link.

Good luck.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.