(SOM) Weighing neighbours in a matrix, simpler way than RBF?

113 Views Asked by At

I've been implementing the SOM algorithm and trying to now change out functions I've used from sklearn.

For a particular SOM problem, I've set a neighborhoodmap to

np.array(  
 [[[a, b] for b in range(10)] for a in range(10)]  
 ).reshape(100, 2)

(I'm going to map the output to a 10x10 grid, a Kohonen map I think it's called, so the 100 corresponds to number of boxes, and the 2 features for (x,y))

Then, to find weights for neighbors to the winning node, I've used that nodes index as center_v neighborhoodmap[center] in (neighborhood is number of neighbors):

rbf_kernel(
            self.neighborhoodmap, center_v, gamma=1 / ((neighborhood) ** 2)
        )

Now, I want to get rid of the rbf_kernel and write something on my own, but not sure how to go about this?

0

There are 0 best solutions below