# How to calculate explained variance of Self Organizing Map

Learning SOM recent days, but getting curious how does the explained variance of SOM is calculated. All the articles I have seen ignore this topic. Can anyone give some ideas?

This is the exact same derivation as is given for the usual derivation of linear regression $$R^2$$ as the proportion of variance explaind by the regression. For that reason, I can see why the derivation may be omitted, if the assumption is that readers have seen the derivation earlier in their statistics studies. This approach has the disadvantage of confusing readers like the OP who perhaps do not know this derivation.

Once the proportion of variance explained is known, that can be compared to the total variance to give the explained variance. The difference between the total and explained variance would be the unexplained variance.

Unfortunately, the proportion of variance explained outside of OLS linear regression is not straightforward. Here, I derive the "proportion of variance explained" interpretation in such a situation and explain why that is a special case. Thus, I am not sold on the idea of "explained variance" in self-organizing maps, though there seems to be a convergence toward the OLS behavior (though this is for the true loss optimum, not where the parameters are when you stop training at what might be a local but not global optimum).

See Fraction of variance unexplained on Wikipedia.

Using similar notation, first calculate the total variance of the input data set. This can be called $\text{VAR}_\text{tot}$. Next, calculate the variance which is unexplained, i.e. the variance of the set of residual vectors, where a residual vector is an input vector minus the SOM node vector of its Best Matching Unit (BMU). Call this $\text{VAR}_\text{err}$.

The Fraction of Variance Unexplained (FVU) is then

$\text{FVU} = {\text{VAR}_\text{err} \over \text{VAR}_\text{tot}}$

and the Fraction of Variance Explained (FVE) is

$\text{FVE} = 1 - \text{FVU}$.

If you want an absolute value, the Variance Explained ($\text{VAR}_\text{exp}$) is simply

$\text{VAR}_\text{exp} = \text{VAR}_\text{tot} - \text{VAR}_\text{err}$.