SNN for classification

Hi! I’ve read about handwritten digit classification using the SNN, but I’d like to know if it is possible to have some other examples of the SNN use in classification task. In particular, I have a data set composed of 8 features (different criteria to distinguish the signals) and labels (that indicate the class of each signal), so I’d like to train the SNN in order to classify new signals (of the Test Set).
Thank you in advance!

1 Like

The same ideas as in this example should work, you’ll just need to modify the input data (load the inputs and targets for your task, instead of the MNIST dataset). For example, in this example we’re also using NengoDL to train a model, but with a different data set. If you have a specific issue you’re running in to when attempting that I might be able to provide more specific help, but it’s hard to say in general!

Thank you, your advice was very useful. Now I have another question about the classification of handwritten digits ([MNIST]). I cannot understand totally the last plots, in particular the following lines:

for i in range(5):
plt.figure()
plt.subplot(1, 2, 1)
plt.imshow(np.reshape(test_data[inp][i, 0], (28, 28)))
plt.axis(‘off’)

plt.subplot(1, 2, 2)
plt.plot(sim.trange(), sim.data[out_p_filt][i])
plt.legend([str(i) for i in range(10)], loc="upper left")
plt.xlabel("time")

Can I have an explanation or more documentation about it?
Thank you in advance

Anything you see with the plt prefix is using the matplotlib library. They have a lot of documentation and tutorials here. For example, you can find more information about plt.subplot here.

Sorry, maybe I misspoke. I’d like to have more information about the following line:

plt.plot(sim.trange(), sim.data[out_p_filt][i])

I can understand that the plot represents the probability of being a specific digit (the highest curve is related to the sample label), but I cannot understand what is sim.data[out_p_filt][i] . Is it a measure of the probability? In that case, what is it in particular?
Thank you

Sorry, I missed your reply! sim.data[out_p_filt][i] is the filtered output spike trains from the final layer of neurons in the network. It doesn’t have any particular meaning or units, we’ve just trained it in such a way that the correct digit should have the highest value. That is how the cross-entropy objective function works; it doesn’t particularly matter what the outputs are, it is their relative magnitude that is significant.

If you wanted to convert those values into probabilities, you could put them through the softmax function.