本文整理汇总了Python中minisom.MiniSom.load_map方法的典型用法代码示例。如果您正苦于以下问题:Python MiniSom.load_map方法的具体用法?Python MiniSom.load_map怎么用?Python MiniSom.load_map使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类minisom.MiniSom
的用法示例。
在下文中一共展示了MiniSom.load_map方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: init
# 需要导入模块: from minisom import MiniSom [as 别名]
# 或者: from minisom.MiniSom import load_map [as 别名]
class Som:
def init(self):
self.core = MiniSom(50,50,6,sigma=.8,learning_rate=.5) # needs to match generating minisom command (specifically the load_map)
self.core.load_map()
self.callme = rospy.Service("mapping", Compute, self.callback)
print "SOM setup complete"
def callback(self, data):
vector = np.array([data.fx, data.fy, data.fz, data.tx, data.ty, data.tz]) # format as needed
print vector
w = self.core.winner(vector)
return w[0],w[1]
示例2: MiniSom
# 需要导入模块: from minisom import MiniSom [as 别名]
# 或者: from minisom.MiniSom import load_map [as 别名]
data = tacitus.cv_21
num = tacitus.cv_21w
n_samples, n_features = data.shape
######################################
# Functional Code Below:
if mode == 1:
print "Using SOM"
drmap = MiniSom(50,50,6,sigma=.8,learning_rate=.5) # Replace 64 with the dimensions of desired target (6)
if fresh_data == 1:
print "Training..."
drmap.train_random(data,1500) # random training
print "\n...ready!"
elif fresh_data == 0:
print "Loading Data"
drmap.load_map()
# plotting the results
from pylab import text,show,cm,axis,figure,subplot,imshow,zeros
figure(1)
im = 0
result = np.array([])
for x,t in zip(data,num): # scatterplot
w = drmap.winner(x)
result.resize((im+1,3))
result[im][0]=w[0]
result[im][1]=w[1]
result[im][2]=num[im]
text(w[0]+.5, w[1]+.5, str(t), color=cm.Dark2(t / 8.), fontdict={'weight': 'bold', 'size': 11})
im = im + 1
axis([0,drmap.weights.shape[0],0,drmap.weights.shape[1]])