Advertisement
Guest User

Untitled

a guest
Dec 9th, 2016
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.78 KB | None | 0 0
  1. input[1] = collision_ray(1,-40);
  2. input[2] = collision_ray(2,-20);
  3. input[3] = collision_ray(3,0);
  4. input[4] = collision_ray(4,20);
  5. input[5] = collision_ray(5,40);
  6.  
  7. //Hidden Layer logic
  8. var n1;//Node 1
  9. n1 = (input[1] * input1weight[1]) +
  10. (input[2] * input2weight[1]) +
  11. (input[3] * input3weight[1]) +
  12. (input[4] * input4weight[1]) +
  13. (input[5] * input5weight[1]) ;
  14. node[1] = dsin(n1);
  15. var n2;//Node 2
  16. n2 = (input[1] * input1weight[2]) +
  17. (input[2] * input2weight[2]) +
  18. (input[3] * input3weight[2]) +
  19. (input[4] * input4weight[2]) +
  20. (input[5] * input5weight[2]) ;
  21. node[2] = dsin(n2);
  22. var n3;//Node 3
  23. n3 = (input[1] * input1weight[3]) +
  24. (input[2] * input2weight[3]) +
  25. (input[3] * input3weight[3]) +
  26. (input[4] * input4weight[3]) +
  27. (input[5] * input5weight[3]) ;
  28. node[3] = dsin(n3);
  29. var n4;//Node 4
  30. n4 = (input[1] * input1weight[4]) +
  31. (input[2] * input2weight[4]) +
  32. (input[3] * input3weight[4]) +
  33. (input[4] * input4weight[4]) +
  34. (input[5] * input5weight[4]) ;
  35. node[4] = dsin(n4);
  36. var n5;//Node 5
  37. n5 = (input[1] * input1weight[5]) +
  38. (input[2] * input2weight[5]) +
  39. (input[3] * input3weight[5]) +
  40. (input[4] * input4weight[5]) +
  41. (input[5] * input5weight[5]) ;
  42. node[5] = dsin(n5);
  43.  
  44. //Network output
  45. var out1, out2, out3;
  46. out1 = (node[1] * node1weight[1]) + (node[2] * node2weight[1]) + (node[3] * node3weight[1]) + (node[4] * node4weight[1]) + (node[5] * node5weight[1]);
  47. out2 = (node[1] * node1weight[2]) + (node[2] * node2weight[2]) + (node[3] * node3weight[2]) + (node[4] * node4weight[2]) + (node[5] * node5weight[2]);
  48. out3 = (node[1] * node1weight[3]) + (node[2] * node2weight[3]) + (node[3] * node3weight[3]) + (node[4] * node4weight[3]) + (node[5] * node5weight[3]);
  49. output[1] = out1;
  50. output[2] = out2;
  51. output[3] = out3;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement