susi
susi copied to clipboard
ValueError: Found array with dim 3. None expected <=2.
Been bashing my head against this one. I have a hyperspectral cube from drill core scanning:
box.shape
(3590, 30, 249)
som = Susi.SOMClustering()
test = som.fit(box)
ValueError: Found array with dim 3. None expected <= 2.
The SOM is designed to take M input vectors with N dimensions, so the data should have a shape of (M, N). Yours is image data with a shape of (M, N, K). This does not yet work with this package. One idea could be to flatten your data:
import numpy as np
data = np.reshape(box, newshape=(3590, -1))
som = Susi.SOMClustering()
som.fit(data)
Does that work for you?
Hi, thanks for the reply.
Yes, I have tried the .fit method with flattened data, and it runs with no errors. The trouble I am having is then translating the som outputs back to the image to visualise the distribution of clusters. I will keep playing with it.
It is good to have confirmation that M x N data is required and I wasnt just calling susi incorrectly
Thanks
Glad to hear that it works!
For the interpretation of the results: what exactly do you want to achieve with the SOM? What do you want to visualize?
See examples/SOMClustering.ipynb for plot examples.
Closing this for now - can be reopened for more questions