Skip to content
/ SOM Public

This is python implementation for Kohonen Self Organizing map using numpy and tensor

Notifications You must be signed in to change notification settings

pankajr141/SOM

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SOM

This is python implementation for Kohonen Self Organizing map using numpy and tensor

Installtion

Python 3 pip install somlib

Usage

  1. Numpy implementation
	from somlib import som
	s = som.SOM(neurons=(5,5), dimentions=3, n_iter=500, learning_rate=0.1)
	s.train(samples)  # samples is a n x 3 matrix
	print("Cluster centres:", s.weights_)
	print("labels:", s.labels_)
	result = s.predict(samples)

Here 5,5 is the dimention of neurons, 3 is the number of features. samples is numpy array with each sample a 3 dimentional vector

  1. Tensor implementation
	from somlib import som
	s = SOM(neurons=(5,5), dimentions=3, n_iter=500, learning_rate=0.1, mode="tensor")
	s.train(samples)  # samples is a n x 3 matrix
	print("Cluster centres:", s.weights_)
	print("labels:", s.labels_)
	result = s.predict(samples)

Display clusters

To display clusters after training use this

s.displayClusters(samples)

clusters

About

This is python implementation for Kohonen Self Organizing map using numpy and tensor

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages