abhinavralhan / kohonen-maps Goto Github PK
View Code? Open in Web Editor NEWImplementation of SOM and GSOM
License: MIT License
Implementation of SOM and GSOM
License: MIT License
Hallo, I am trying to understand your syntax for som implementation form scratch. I found something is not right.
for i in range(n_iterations):
# select a training example at random
t = data[:, np.random.randint(0, n)].reshape(np.array([m, 1]))
# find its Best Matching Unit
bmu, bmu_idx = find_bmu(t, net, m)
# decay the SOM parameters
r = decay_radius(init_radius, i, time_constant)
l = decay_learning_rate(init_learning_rate, i, n_iterations)
# update weight vector to move closer to input
# and move its neighbours in 2-D vector space closer
for x in range(net.shape[0]):
for y in range(net.shape[1]):
w = net[x, y, :].reshape(m, 1)
w_dist = np.sum((np.array([x, y]) - bmu_idx) ** 2)
w_dist = np.sqrt(w_dist)
if w_dist <= r:
# calculate the degree of influence (based on the 2-D distance)
influence = calculate_influence(w_dist, r)
# new w = old w + (learning rate * influence * delta)
# where delta = input vector (t) - old w
new_w = w + (l * influence * (t - w))
net[x, y, :] = new_w.reshape(1, 3)
I think it is supposed to be
w_dist = np.sum((np.array([x, y]) - bmu) ** 2)
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.