You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
The text was updated successfully, but these errors were encountered:
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:but I'm wondering if there is built-in method in a somoclu class that can do such job?
The text was updated successfully, but these errors were encountered: