NeuralNetwork - Brain

An easy example flow based on the brain node for categorizing colors

[{"id":"c07ef2fe.05ed88","type":"debug","z":"d187ee6c.0d0f88","name":"","active":true,"console":"false","complete":"net","x":720,"y":120,"wires":[]},{"id":"3d31f03a.e7f06","type":"inject","z":"d187ee6c.0d0f88","name":"Trigger","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":133.36669921875,"y":98.36666870117188,"wires":[["fb1ed266.3cc0e8"]]},{"id":"fb1ed266.3cc0e8","type":"function","z":"d187ee6c.0d0f88","name":"Training Data","func":"// This function return a fake json array\nvar trainData = [{input: { r: 0.03, g: 0.7, b: 0.5 }, output: { black: 1 }},\n           {input: { r: 0.16, g: 0.09, b: 0.2 }, output: { white: 1 }},\n           {input: { r: 0.5, g: 0.5, b: 1.0 }, output: { white: 1 }}]\n\nmsg.trainData = trainData\nreturn msg;","outputs":1,"noerr":0,"x":310,"y":120,"wires":[["e02f65cf.9593f8"]]},{"id":"23a387.7d5c3c7a","type":"debug","z":"d187ee6c.0d0f88","name":"","active":true,"console":"false","complete":"payload","x":710,"y":220,"wires":[]},{"id":"6841aeea.0882","type":"inject","z":"d187ee6c.0d0f88","name":"Trigger","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":130,"y":200,"wires":[["b4290262.acf09"]]},{"id":"b4290262.acf09","type":"function","z":"d187ee6c.0d0f88","name":"Query data","func":"// This function return a fake json array\nvar netJSON = {\"layers\":[{\"r\":{},\"g\":{},\"b\":{}},{\"0\":{\"bias\":0.5976173927716023,\"weights\":{\"r\":3.5006895738532835,\"g\":-4.542455700505483,\"b\":0.9988932386815509}},\"1\":{\"bias\":0.6470978455858952,\"weights\":{\"r\":3.6115725201557827,\"g\":-4.875546614413311,\"b\":1.211740813346471}},\"2\":{\"bias\":-0.3559477465736521,\"weights\":{\"r\":1.1063595019849224,\"g\":-1.857026678772011,\"b\":0.14886809335684345}}},{\"black\":{\"bias\":3.3336645409591017,\"weights\":{\"0\":-3.7876606581596914,\"1\":-4.023316483216229,\"2\":-1.0819957068479935}},\"white\":{\"bias\":-3.29149645757729,\"weights\":{\"0\":3.782751737648757,\"1\":4.173873416865656,\"2\":0.7154074171638515}}}],\"outputLookup\":true,\"inputLookup\":true}    \nvar runData = { r: 2, g: 0.4, b: 2 }\n\nmsg.runData = runData\nmsg.netJSON = netJSON\nreturn msg;","outputs":1,"noerr":0,"x":297,"y":214,"wires":[["e02f65cf.9593f8"]]},{"id":"75b7612f.99f498","type":"comment","z":"d187ee6c.0d0f88","name":"Neural Network","info":"See corresponding Lab instructions in the link below :\n\n[Watson Visual Recognition](https://github.com/watson-developer-cloud/node-red-labs/tree/master/basic_examples/visual_recognition_v3)\n","x":160,"y":60,"wires":[]},{"id":"e02f65cf.9593f8","type":"brain","z":"d187ee6c.0d0f88","name":"brain","learningRate":0.3,"errorThresh":0.005,"iterations":20000,"log":false,"logPeriod":10,"x":495.5,"y":174,"wires":[["c07ef2fe.05ed88","23a387.7d5c3c7a"]]}]
artifex23

Flow Info

created 1 year, 1 month ago

Node Types

Core
  • comment (x1)
  • debug (x2)
  • function (x2)
  • inject (x2)
Other

Tags

  • Neural
  • Network
  • Brain
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option