alexarnimueller / som Goto Github PK
View Code? Open in Web Editor NEWSelf organizing Kohonen map in Python with periodic boundary conditions
License: Other
Self organizing Kohonen map in Python with periodic boundary conditions
License: Other
Based on my understanding of how SOM works, I think there should be a weight values or called neurons center could be found, but i didn't find the related methods/functions in the document, how could I find it?
Hi,
Im try to use the iris dataset, but I get errors all the time
my code
iris = pd.read_csv('Iris.csv')
dataset = iris.drop(['Species','Id'],axis = 1)
from sklearn.preprocessing import StandardScaler
standard = StandardScaler()
cleanDataSet = standard.fit_transform(dataset)
cleanDataSet = pd.DataFrame(cleanDataSet).dropna()
som = SOM(10, 10) # initialize the SOM
som.fit(cleanDataSet.to_numpy(), 10000, save_e=True, interval=100)
species = iris['Species']
species_number = species.astype('category').cat.codes
som.plot_point_map(cleanDataSet.to_numpy(), species_number, species)
and the error
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<ipython-input-134-1f7b119e8ffe> in <module>()
----> 1 som.plot_point_map(cleanDataSet.to_numpy(), species_number, species)
1 frames
/content/som.py in <listcomp>(.0)
285
286 if not activities:
--> 287 patches = [mptchs.Patch(color=colors[i], label=targetnames[i]) for i in range(len(targetnames))]
288 legend = plt.legend(handles=patches, bbox_to_anchor=(0., 1.02, 1., .102), loc=3, ncol=len(targetnames),
289 mode="expand", borderaxespad=0.1)
IndexError: list index out of range
I'm don't understand why is this error?
my code:
iris = pd.read_csv('Iris.csv')
dataset = iris.drop(['Species','Id'],axis = 1)
from sklearn.preprocessing import StandardScaler
standard = StandardScaler()
cleanDataSet = standard.fit_transform(dataset)
cleanDataSet = pd.DataFrame(cleanDataSet).dropna()
som = SOM(10, 10) # initialize the SOM
som.fit(cleanDataSet.to_numpy(), 10000, save_e=True, interval=100)
species = iris['Species']
species_number = species.astype('category').cat.codes
# take row 7 for get neighbors
som.get_neighbors(cleanDataSet.iloc[7], data= cleanDataSet.to_numpy(), labels=species.unique() , d=0)
and the error:
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-188-ae42eea72444> in <module>()
----> 1 som.get_neighbors(cleanDataSet.iloc[7], data= cleanDataSet.to_numpy(), labels=['7'] , d=0)
4 frames
/usr/local/lib/python3.6/dist-packages/pandas/core/series.py in __init__(self, data, index, dtype, name, copy, fastpath)
247 'Length of passed values is {val}, '
248 'index implies {ind}'
--> 249 .format(val=len(data), ind=len(index)))
250 except TypeError:
251 pass
ValueError: Length of passed values is 15, index implies 4
hi there,
i keep on having this issue:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 3331, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "", line 1, in
som.plot_point_map(dfs.to_numpy(), labels, np.unique(labels))
File "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", line 278, in plot_point_map
markers[targets[cnt]], color=c, markersize=12)
IndexError: list index out of range
can you help?
alex
Hi there - thanks for making this available!
Installation with pip currently fails for me on MacOS 10.15.7 and python 3.6.13 with this error:
...
with open('requirements.txt', 'r') as f:
FileNotFoundError: [Errno 2] No such file or directory: 'requirements.txt'
...
Installing directly from github works with:
pip install git+https://github.com/alexarnimueller/som
i want to change learning rate, where is this ??
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.