Python 自组织地图:彩色可视化
我试图开发一个自组织的地图,但我有一个基本的问题,我没有找到一个解决方案,写在pcolor颜色 我的剧本:Python 自组织地图:彩色可视化,python,matplotlib,Python,Matplotlib,我试图开发一个自组织的地图,但我有一个基本的问题,我没有找到一个解决方案,写在pcolor颜色 我的剧本: import pandas as pd import numpy as np import matplotlib.pyplot as plt dataset = pd.read_csv("/Users/alainmeo/Desktop/deep learning auto adaptating map/data.csv", header=None,
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
dataset = pd.read_csv("/Users/alainmeo/Desktop/deep learning auto
adaptating map/data.csv",
header=None, sep=';')
x = dataset.iloc[:].values
from sklearn.preprocessing import MinMaxScaler
sc = MinMaxScaler()
x = sc.fit_transform(x)
from minisom import MiniSom
som = MiniSom(x=10, y=10, input_len=5)
som.train_random(x, num_iteration=100)
from pylab import bone, pcolor, colorbar, plot, show
bone()
for i, x in enumerate(x):
liste = list(x)
liste[0]=liste[0]*255
liste[1]=liste[1]*255
liste[2]=liste[2]*255
liste[3]=liste[3]*255
print(liste)
w = som.winner(x)
if liste[0]>liste[1] and liste[0]>liste[2] and liste[0]>liste[3]:
pcolor(w[0]+0.5 ,w[1]+0.5, cmap="RdBu")
if liste[1]>liste[0] and liste[1]>liste[2] and liste[1]>liste[3]:
pcolor(w[0]+0.5 ,w[1]+0.5, cmap="RdBu")
if liste[2]>liste[1] and liste[2]>liste[0] and liste[2]>liste[3]:
pcolor(w[0]+0.5 ,w[1]+0.5, cmap="RdBu")
if liste[3]>liste[1] and liste[3]>liste[2] and liste[3]>liste[0]:
pcolor(w[0]+0.5 ,w[1]+0.5, cmap="RdBu")
show()
我的错误
line 5553, in _pcolorargs
'Illegal arguments to %s; see help(%s)' % (funcname, funcname))
TypeError: Illegal arguments to pcolor; see help(pcolor)
我想让输出神经元的每一个值在地图上都有一个单色的强度,但我找不到解决方案。你能帮我吗
提前感谢
pcolor
不会在地图上添加单个像素。相反,它希望绘制一个数组(连同位置)。尝试将数据创建与打印分离。使用您想要显示的内容创建一个数组,然后将该数组(以及相应的坐标数组)提供给pcolor
。thx very mutch:))probleme over;)