Hello, I need some expert guidance on machine learning using STDP on brian2

Hello everyone! I am new to this forum and I have some questions regarding the usage of STDP on training a model for fischer iris dataset classification. This is what I am doing:

As we know, the sklearn iris dataset consists of 4 features and 3 classes. Right now, what I did was to normalize the dataset and then multiply by 255 for the 4 features to the range (0-255). Based on understanding, the proportion of the features seem to play an important role in determining whether it is of class 0, class1 or class2. So I decided to use STDP with 4 Poisson input neurons connected to 1 output neuron just to see which class this output neuron learns.

What was done: I randomly choose 100 out of the 150 samples, with different classes and encoded them with Poisson spike times proportional to their intensity (IN this case, the relative proportion of the 4 feature vector), by exposing each sample for 300ms, followed by 300ms of NO-INPUT period to allow decay of potential to resting value. This means (300 + 300) * 100 ms total duration for training.

What happened: After training, I observed the (4x1) synaptic weights and some proportions were observed, seemingly corresponding to a particular class (Class 0 usually have stronger feature 1 and 2, while class 1 usually have stronger feature 1 and 3 if we observe carefully). Before testing, I was hoping that it will fire the most for THAT class relative to the other 2 classes, so I proceeded to testing.

After testing: It seems like by passing class 0, class1 and class2 individually to the training network by turning off the STDP weight updates, it spiked the most for class2, which shouldnt be the case since the weights are more corresponding towards class 1 by observation?. Am I doing anything wrong here. FYI all my synaptic weights are positive, so do I need 1 or 2 of these weights to be negative?

The code was implemented on brian2, a link is attached:

I would appreciate if someone could assist me on this, such as what could be wrong, what parameters I should change or even make some edits to my code and show me something that could work from here? Thank you so much! (Someone who has been stuck on this problem for a few months :frowning: )