uni-courses / snncompare

Runs networkx graphs representing spiking neural networks of LIF-neurons on lava-nc or networkx.
GNU Affero General Public License v3.0
2 stars 0 forks source link

Spike once output into degree_receiver nodes #177

Closed a-t-0 closed 1 year ago

a-t-0 commented 1 year ago

Changed from:

rand_ceil = input_graph.graph["alg_props"]["rand_ceil"]

to:

rand_ceil = input_graph.graph["alg_props"]["rand_ceil"]+1

Because for larger graphs the rand initialisation led to identical degree_receiver u values at the first timestep.

Yet changing leads to different neuman nodes. Either sync results or resolve otherwise.

Also did that for degree_receiver into degree_receiver.

For t = 94 on debug 3 at:

{'adaptation': {'redundancy': 2},
 'algorithm': {'MDSA': {'m_val': 1}},
 'graph_nr': 2,
 'graph_size': 7,
 'max_duration': None,
 'radiation': {'neuron_death': 0.05},
 'seed': 8,
 'simulator': 'simsnn',
 'unique_id': '8d792eb0a4a2f1e7a77f6ce180fadbe46f0210ff6a41ba25c3e1f330d867e9ec'}

The degree_receiver_2_0_1 spikes whereas neuman algo in:

for node_circuit, neighbour_index in deg_winner_dict.items():
            print(f'node_circuit={node_circuit}, winner=degree_receiver_'
                  +f"{node_circuit}_{neighbour_index}_{loop}")

expects:

rand_ceil=7
node_circuit=0, winner=degree_receiver_0_4_0
node_circuit=1, winner=degree_receiver_1_4_0
node_circuit=2, winner=degree_receiver_2_7_0
node_circuit=3, winner=degree_receiver_3_4_0
node_circuit=4, winner=degree_receiver_4_0_0
node_circuit=5, winner=degree_receiver_5_4_0
node_circuit=6, winner=degree_receiver_6_4_0
node_circuit=7, winner=degree_receiver_7_2_0
node_circuit=0, winner=degree_receiver_0_4_1
node_circuit=1, winner=degree_receiver_1_4_1
node_circuit=2, winner=degree_receiver_2_7_1
node_circuit=3, winner=degree_receiver_3_4_1
node_circuit=4, winner=degree_receiver_4_0_1
node_circuit=5, winner=degree_receiver_5_4_1
node_circuit=6, winner=degree_receiver_6_4_1
node_circuit=7, winner=degree_receiver_7_2_1

probably because the rand_ceil number is 1 off.

a-t-0 commented 1 year ago

Create a table with for m=0: Per node:

Then in snn verify per group of degree receivers of a node circuit, that the degree_receiver_<node>_<neighbour>_0 of the neighbour with the most countermarks spiked in round m=0.

M>=1

Then for the next round:

TODO: determine who should have the following incoming values: (The node circuit degree receivers, or the degree_receivers pertaining to a neighbour equal to the node in the neumann algorithm). Verify that the positive input into the degree_receiver_<node>_<neighbour>_m coming from the previous round of degree receiver spikes, is equal to the marks at round m of the neumann algorithm. Then verify they all have received the same random number as positive input.

a-t-0 commented 1 year ago

The issue was that the isomorphic graphs can have a different node ordering, leading to different number of nodes per neighbour. This different nr of neighbours was then used to create a different snn_algo, even though the results were compared based on the original input graph, which had different neighbours.

A solution was found by checking if the isomorphic input graph already exists, and if yes, loading that graph from file, to ensure all the nodes on the same isomorphic input graph are "the same".