meta data for this page
  •  

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Last revision Both sides next revision
homeautomation2017:group3:start [2017/03/10 12:03]
suganmira
homeautomation2017:group3:start [2017/03/10 12:04]
suganmira
Line 46: Line 46:
 var brain = require('brain'); var brain = require('brain');
 var fs = require('fs'); var fs = require('fs');
 +
 // Training data for temperature, humidity and switch response // Training data for temperature, humidity and switch response
 var training_data = JSON.parse(fs.readFileSync('training.json', 'utf8')); var training_data = JSON.parse(fs.readFileSync('training.json', 'utf8'));
 var net = new brain.NeuralNetwork(); var net = new brain.NeuralNetwork();
 +
 // Training the neural network // Training the neural network
 net.train(training_data); net.train(training_data);
 +
 // Predict a switch response based on a temperature and humidity input // Predict a switch response based on a temperature and humidity input
 var output = net.run([0.22, 0.11]);     // 0.00112'' var output = net.run([0.22, 0.11]);     // 0.00112''