# Visualizing Variance / Standard Deviation for categories

Data Structure:

Method Category   Variance for X
1         A             20
1         B             14
1         C             16
2         A             14
2         B             19


Where X was not used for classification, but is evaluation criteria. The objective is select method which produces classification with minimum possible variance for X for most of class / overall least variance.

My question: is there some standard (or obscure) method of visualizing variance for large number of categories?

• How "large" is the number of categories? – Romain Reboulleau Sep 29 '19 at 6:46
• 4 Methods. 12 Categories. – Martan Sep 29 '19 at 7:05

I know this may not exactly correspond to what you need, but my first idea would not be to visualize the variances. Instead, I would define a metric for each method.

For instance, considering all results obtained with a given, you have a vector of outputs (one Variance for X for each Category), then you can simply compute a p-norm of this vector, and compare it to the norm obtained for other methods:

$$\left\lVert x\right\rVert_p = \left( \sum_{i=1}^n x_i^p \right)^{1/p}$$

$$p=2$$ gives you the euclidian norm, you can increase or decrease $$p$$ depending on if you want to raise attention on maximal values or the average.

In terms of visualization, you could simply plot (in a bar plot for instance) a few norms that you selected (orders 1, 2, and infinite for instance).

For a pure visualization, you could plot the data in violin plots. For instance in python:

import seaborn as sns
sns.violinplot(x="Method", y="Variance for X", data=your_data_as_df)


Each violin would give you an idea of how the data is distributed over all categories.