7 hours ago7 hr Hi,I build with the neuron from Drosophila a network,that can recognice prime numbers with 5 neurons up to 255 in binary notationDietmar prim.html Edited 7 hours ago7 hr by Dietmar
7 hours ago7 hr Author @xper Can you please enable, that my prim.html is clickable and can be seen at once, direct in my post?It would be really crazy niceDietmar
6 hours ago6 hr Author Hi,eight input switches and five neurons.OFF = 0ON = 1The eight switches represent these values:Switch: x0 x1 x2 x3 x4 x5 x6 x7 Value: 1 2 4 8 16 32 64 128 Add the values of the switches that are ON. This gives the number to test.For example, switching ON 128, 8 and 1 gives:128 + 8 + 1 = 137 This lets us enter every number from 0 to 255.What does a neuron do?It adds and subtracts the signals it receives. If the total reaches its threshold, it switches ON. Otherwise, it stays OFF.For example:5*x1 means: Add 5 if switch x1 is ON. Add nothing if switch x1 is OFF. -4*x2 means: Subtract 4 if switch x2 is ON. Subtract nothing if switch x2 is OFF. The outputs of the five neurons are called h1, h2, h3, h4 and h5. They are always 0 or 1.Calculate the neurons in order: 1, 2, 3, 4, 5.Neuron 1 calculates:S1 = -x0 + 5*x1 + 3*x2 + x3 + 2*x4 - x5 + 4*x6 + x7 If S1 >= 7, then h1 = 1. Otherwise, h1 = 0. Neuron 2 also uses the result from Neuron 1:S2 = 2*x0 + x1 - 4*x2 + 3*x3 - 3*x4 + 7*x5 - 4*x6 + 3*x7 + 5*h1 If S2 >= 6, then h2 = 1. Otherwise, h2 = 0. Neuron 3 calculates:S3 = -3*x0 - 2*x1 + 2*x3 + x4 + 3*x5 + x6 - 2*x7 + 5*h1 + 6*h2 If S3 >= 4, then h3 = 1. Otherwise, h3 = 0. Neuron 4 calculates:S4 = 13*x0 + 4*x1 - 7*x2 + 9*x3 - 8*x4 + 6*x5 - 10*x6 + 6*x7 + 5*h1 - 13*h2 - 7*h3 If S4 >= 4, then h4 = 1. Otherwise, h4 = 0. Neuron 5 gives the final answer:S5 = 2*x1 + 6*x2 - 3*x3 + 4*x4 + 4*x5 + 7*x6 - 5*x7 - 5*h1 + 10*h2 - 9*h3 + 13*h4 If S5 >= 15, then h5 = 1: PRIME. Otherwise, h5 = 0: NOT PRIME. Here, * means multiplication and >= means “greater than or equal to”. Reaching the threshold exactly is enough to switch ON.A neuron passes only its ON/OFF result to the next neurons. For example, if Neuron 2 has a total of 8, its output is h2 = 1, not 8.For our example, 137:Neuron: 1 2 3 4 5 Output: 0 1 0 1 1 The last neuron is ON, so 137 is prime.For 169:Neuron: 1 2 3 4 5 Output: 0 1 1 1 0 The last neuron is OFF, so 169 is not prime. Indeed, 169 = 13*13.All 256 possible inputs were tested: 54 primes, 202 non-primes, zero errors. The network also correctly handles 0, 1 and 2.There are five neurons in total, including the final output neuron.Dietmar
Create an account or sign in to comment