我使用 R 中的 Kohonen 包创建了一个 SOM 地图,并希望在地图上标识一个特定的数据点位置。即所使用的系列是由 2 列组成的矩阵,并且增加了一行,我如何在地图本身或任何特定行上标记最后一次观察的位置?我使用的代码如下:
require(kohonen)
pretty_palette <- c("#1f77b4", '#ff7f0e', '#2ca02c', '#d62728', '#9467bd', '#8c564b', '#e377c2')
data_train <- na.omit(cbind(dataseries_1,dataseries_2))
data_train_matrix <- as.matrix(scale(data_train))
som_grid <- somgrid(xdim = 10, ydim=10, topo="hexagonal")
som_model <- som(data_train_matrix,
grid=som_grid,
rlen=100,
alpha=c(0.05,0.01),
keep.data=TRUE,
n.hood="circular")
som_cluster <- cutree(hclust(dist(som_model$codes)), 4)
plot(som_model, type="mapping", bgcol =pretty_palette[som_cluster] , main = "Regimes Map")
add.cluster.boundaries(som_model, som_cluster)
任何帮助表示赞赏
谢谢