-
Notifications
You must be signed in to change notification settings - Fork 73
Get bmu of testing data #164
Copy link
Copy link
Open
Description
I can use som.bmus to get the coordinates of bmus of the training data, but I want to calculate the coordinates of bmus of testing data from a pre-trained SOM. I can define something like:
def f(i, data):
dmap = np.sum(((data[i] - som.codebook)**2)**0.5, axis=2)
return np.asarray(np.unravel_index(np.argmin(dmap), dmap.shape, order='F'))
def get_test_bmus(som, data):
with Pool() as p:
bmus = p.map(lambda i: f(i, data), np.arange(len(data))) # use multiprocess since the testing data can be very large
return np.asarray(bmus)
but I'm wondering if there is built-in method in a somoclu class that can do such job?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels