简体   繁体   English

我如何知道一个元素在python中属于哪个自组织映射(SOM)集群?

[英]How can I know which cluster of self-organizing map (SOM) an element belongs to in python?

I am new with clustering and neural nets, and I have just started using Self-Organizing Maps (SOM) to perform some clustering.我是聚类和神经网络的新手,我刚刚开始使用自组织映射 (SOM) 来执行一些聚类。 I have a 15 dimensional dataset and I created a som with the next code:我有一个 15 维数据集,我用下一个代码创建了一个 som:

size = 20
from minisom import MiniSom    
som = MiniSom(size, size, 15, sigma=0.3, learning_rate=0.9, random_seed=149)
som.train_random(data, 650000, verbose=True)

And I plotted the som the next way:我以下一种方式绘制了 som:

plt.figure()
plt.pcolor(som.distance_map().T, cmap='Blues')
plt.colorbar()

plt.show()

My question is: if I have a new 15 dimensional element, how can I know which cluster of the som belongs to?我的问题是:如果我有一个新的 15 维元素,我怎么知道 som 属于哪个簇?

Best Matching Unit (BMU)最佳匹配单元 (BMU)

for t in itertools.count():
        i =  np.random.choice(range(len(data)))
        bmu = self.find_bmu(data[i])

Finding the Best Matching Unit寻找最佳匹配单元

create nxn map with random node vector values使用随机节点向量值创建 nxn 映射

loop while s < StepsMax times循环而 s < StepsMax 次数

compute what a "close" node means, based on s根据 s 计算“关闭”节点的含义

compute a learn rate, based on s计算学习率,基于 s

pick a random data item选择一个随机数据项

determine the map node closest to data item (BMU)确定最接近数据项(BMU)的地图节点

for-each node close to the BMU对于靠近 BMU 的每个节点

adjust node vector values towards data item向数据项调整节点向量值

end-loop结束循环

SOM - BMU SOM - BMU

I have a feeling that MiniSom has a function implemented for this:我有一种感觉,MiniSom 为此实现了一个功能:

som.winner(*input_data*)

which returns the node that it is closest to.它返回它最接近的节点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Python中的六边形自组织映射 - Hexagonal Self-Organizing map in Python 在python中可视化自组织映射 - Visualizing self-organizing maps in python 可视化自组织地图或虹膜数据集中的类标签 - Visualizing class labels in self-organizing map plot or iris dataset 用于实现自组织地图的库 sompy - Library sompy for implementing self-organizing maps 如何获得 SOM(自组织地图)中的重要特征? - How to get the important features in SOM(Self Organizing Maps)? Java,C,Python等自组织模糊神经网络(SOFNN)实现 - Self-organizing Fuzzy Neural Network (SOFNN) Implementations in Java, C, Python etc 我们如何使用自组织地图聚类为数据分配标签? (minisom 包) python - how we can assign labels to data using self organizing map clustering? (minisom package) python 运行不断增长的自组织图(GSOM)GitHub 实现失败,出现 AttributeError:“numpy.ndarray”对象没有属性“iteritems” - Running Growing Self-Organizing Map(GSOM) GitHub Implementation failed with AttributeError: 'numpy.ndarray' object has no attribute 'iteritems' 如何更改属于字典的列表中元素的值? - How can I change the value of an element in a list which belongs to a dictionary? 如何通过python绘制带有邻域连接的自组织地图? - How can I plot self organizing maps with neighborhood connections through python?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM