I'm working with the kohonen package (version 3.0.11) in R for applying the self-organising maps algorithm to a large data set.
In order to determine the optimal grid size, I tried to calculate both the quantisation error and the topographic error at various grid sizes, to see at which size their normalised sum is minimal. Unfortunately, whenever I run the topo.error() function, I get an error and I'm wondering if the function is still usable after version 2.0.19 of the package (that's the latest version for which I found documentation about the topo.error function).
I know other packages such as aweSOM have similar functions, but the kohonen::topo.error()
function only uses the data set and grid parameters as arguments, and not the trained SOM model, saving a substantial amount of computation time.
Here is a minimal reproducible example with the output error:
Code
library('kohonen')
data(yeast)
set.seed(261122)
## take only complete cases
X <- yeast[[3]][apply(yeast[[3]], 1, function(x) sum(is.na(x))) == 0,]
yeast.som <- som(X, somgrid(5, 8, "hexagonal"))
## quantization error
mean(yeast.som$distances)
## topographical error
topo.error(yeast.som, "bmu")
Output
Error in topo.error(yeast.som, "bmu") :
could not find function "topo.error"