Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Initial Commit

  • Loading branch information...
commit e341ab94b1eff85bf1798e5a0e40ce7dab092505 0 parents
@robrighter authored
Showing with 447 additions and 0 deletions.
  1. 0  README
  2. +47 −0 app.js
  3. +400 −0 data.csv
0  README
No changes.
47 app.js
@@ -0,0 +1,47 @@
+var brain = require("../brain/brain"),
+ sys = require("sys"),
+ puts = sys.puts,
+ csv = require('../node-csv');
+
+
+var net = new NeuralNetwork();
+info = [];
+
+csv.csv.each("data.csv").addListener("data", function(data) {
+ info.push({date : parseFloat(data[0]), value : parseFloat(data[1])});
+}).addListener("end", function() {
+ var depth = 15;
+ var history = makeHistoryList(depth,info);
+ history = history.slice(0, history.length-1);
+ var totrain = history.map(function(item){
+ return {input: item.slice(0,depth-2), output: [item[depth-1]]};
+ });
+
+ puts("Training with: ");
+ puts(sys.inspect(totrain));
+ net.train(totrain);
+ var result = net.run([0.81370,0.81490,0.81190,0.81140,0.80880,0.80870,
+ 0.81090,0.81930,0.81640,0.8090,0.79770,0.79610,0.79620]);
+ puts("The result is: " + sys.inspect(result));
+});
+
+
+function makeHistoryList(depth, info){
+ var counter = 0;
+ var acc = [];
+ info.forEach(function(item){
+ if(counter>depth){
+ acc.push(makeHistoryItem(counter,depth,info));
+ }
+ counter++;
+ });
+ return acc;
+}
+
+function makeHistoryItem(index, depth, info){
+ var toreturn = [];
+ for(var i=0; i<depth; i++){
+ toreturn.push(info[index-i]['value']);
+ }
+ return toreturn.reverse();
+}
400 data.csv
@@ -0,0 +1,400 @@
+06/01/2009,0.7070
+06/02/2009,0.70560
+06/03/2009,0.7040
+06/04/2009,0.70260
+06/05/2009,0.70560
+06/06/2009,0.7080
+06/07/2009,0.71620
+06/08/2009,0.71620
+06/09/2009,0.71870
+06/10/2009,0.71690
+06/11/2009,0.71160
+06/12/2009,0.71240
+06/13/2009,0.71160
+06/14/2009,0.71370
+06/15/2009,0.71370
+06/16/2009,0.72020
+06/17/2009,0.72250
+06/18/2009,0.72090
+06/19/2009,0.71720
+06/20/2009,0.7180
+06/21/2009,0.71780
+06/22/2009,0.71770
+06/23/2009,0.72040
+06/24/2009,0.71730
+06/25/2009,0.71180
+06/26/2009,0.71670
+06/27/2009,0.71170
+06/28/2009,0.71160
+06/29/2009,0.71160
+06/30/2009,0.71190
+07/01/2009,0.710
+07/02/2009,0.71010
+07/03/2009,0.71040
+07/04/2009,0.7150
+07/05/2009,0.71560
+07/06/2009,0.71560
+07/07/2009,0.71710
+07/08/2009,0.7160
+07/09/2009,0.71970
+07/10/2009,0.71670
+07/11/2009,0.71670
+07/12/2009,0.71780
+07/13/2009,0.71780
+07/14/2009,0.71720
+07/15/2009,0.71560
+07/16/2009,0.71210
+07/17/2009,0.70920
+07/18/2009,0.70860
+07/19/2009,0.70940
+07/20/2009,0.70940
+07/21/2009,0.70470
+07/22/2009,0.70370
+07/23/2009,0.70410
+07/24/2009,0.70310
+07/25/2009,0.70460
+07/26/2009,0.70440
+07/27/2009,0.70430
+07/28/2009,0.70250
+07/29/2009,0.7030
+07/30/2009,0.70820
+07/31/2009,0.71130
+08/01/2009,0.70690
+08/02/2009,0.70170
+08/03/2009,0.70160
+08/04/2009,0.69890
+08/05/2009,0.69440
+08/06/2009,0.69430
+08/07/2009,0.69510
+08/08/2009,0.6990
+08/09/2009,0.70530
+08/10/2009,0.70530
+08/11/2009,0.70530
+08/12/2009,0.70680
+08/13/2009,0.7060
+08/14/2009,0.70160
+08/15/2009,0.70150
+08/16/2009,0.70430
+08/17/2009,0.70440
+08/18/2009,0.70850
+08/19/2009,0.70870
+08/20/2009,0.70640
+08/21/2009,0.70260
+08/22/2009,0.70
+08/23/2009,0.69830
+08/24/2009,0.69820
+08/25/2009,0.69830
+08/26/2009,0.69910
+08/27/2009,0.70030
+08/28/2009,0.70110
+08/29/2009,0.69690
+08/30/2009,0.69940
+08/31/2009,0.69940
+09/01/2009,0.69920
+09/02/2009,0.6990
+09/03/2009,0.70280
+09/04/2009,0.70040
+09/05/2009,0.7010
+09/06/2009,0.70
+09/07/2009,0.70
+09/08/2009,0.69770
+09/09/2009,0.69350
+09/10/2009,0.68870
+09/11/2009,0.68670
+09/12/2009,0.68530
+09/13/2009,0.68650
+09/14/2009,0.68640
+09/15/2009,0.68620
+09/16/2009,0.6840
+09/17/2009,0.68090
+09/18/2009,0.6790
+09/19/2009,0.67970
+09/20/2009,0.680
+09/21/2009,0.680
+09/22/2009,0.68150
+09/23/2009,0.67780
+09/24/2009,0.67620
+09/25/2009,0.67920
+09/26/2009,0.68170
+09/27/2009,0.6810
+09/28/2009,0.68090
+09/29/2009,0.68340
+09/30/2009,0.68540
+10/01/2009,0.68390
+10/02/2009,0.68560
+10/03/2009,0.6870
+10/04/2009,0.68630
+10/05/2009,0.68610
+10/06/2009,0.68370
+10/07/2009,0.67990
+10/08/2009,0.68040
+10/09/2009,0.67770
+10/10/2009,0.67860
+10/11/2009,0.67910
+10/12/2009,0.67910
+10/13/2009,0.67830
+10/14/2009,0.67550
+10/15/2009,0.67180
+10/16/2009,0.66980
+10/17/2009,0.67060
+10/18/2009,0.6710
+10/19/2009,0.6710
+10/20/2009,0.67060
+10/21/2009,0.66860
+10/22/2009,0.66860
+10/23/2009,0.66680
+10/24/2009,0.66560
+10/25/2009,0.66650
+10/26/2009,0.66660
+10/27/2009,0.66710
+10/28/2009,0.67310
+10/29/2009,0.67630
+10/30/2009,0.67760
+10/31/2009,0.67550
+11/01/2009,0.67980
+11/02/2009,0.67980
+11/03/2009,0.67750
+11/04/2009,0.6790
+11/05/2009,0.67710
+11/06/2009,0.67320
+11/07/2009,0.67260
+11/08/2009,0.67370
+11/09/2009,0.67350
+11/10/2009,0.66880
+11/11/2009,0.66750
+11/12/2009,0.66680
+11/13/2009,0.66910
+11/14/2009,0.67230
+11/15/2009,0.67120
+11/16/2009,0.67110
+11/17/2009,0.66840
+11/18/2009,0.67030
+11/19/2009,0.67030
+11/20/2009,0.67090
+11/21/2009,0.67190
+11/22/2009,0.6730
+11/23/2009,0.6730
+11/24/2009,0.66920
+11/25/2009,0.66890
+11/26/2009,0.66540
+11/27/2009,0.66330
+11/28/2009,0.66940
+11/29/2009,0.66740
+11/30/2009,0.66730
+12/01/2009,0.66550
+12/02/2009,0.66440
+12/03/2009,0.66320
+12/04/2009,0.66270
+12/05/2009,0.66630
+12/06/2009,0.67340
+12/07/2009,0.67330
+12/08/2009,0.67370
+12/09/2009,0.67580
+12/10/2009,0.67920
+12/11/2009,0.67910
+12/12/2009,0.68010
+12/13/2009,0.68440
+12/14/2009,0.68430
+12/15/2009,0.68280
+12/16/2009,0.68540
+12/17/2009,0.68750
+12/18/2009,0.69420
+12/19/2009,0.69680
+12/20/2009,0.69770
+12/21/2009,0.69780
+12/22/2009,0.69810
+12/23/2009,0.70010
+12/24/2009,0.70040
+12/25/2009,0.69640
+12/26/2009,0.69550
+12/27/2009,0.69460
+12/28/2009,0.69530
+12/29/2009,0.6950
+12/30/2009,0.6950
+12/31/2009,0.69770
+01/01/2010,0.69610
+01/02/2010,0.69890
+01/03/2010,0.6950
+01/04/2010,0.69890
+01/05/2010,0.69670
+01/06/2010,0.69370
+01/07/2010,0.69620
+01/08/2010,0.69610
+01/09/2010,0.69770
+01/10/2010,0.69420
+01/11/2010,0.69410
+01/12/2010,0.68950
+01/13/2010,0.68980
+01/14/2010,0.68960
+01/15/2010,0.68910
+01/16/2010,0.69370
+01/17/2010,0.69540
+01/18/2010,0.69550
+01/19/2010,0.69570
+01/20/2010,0.6970
+01/21/2010,0.70510
+01/22/2010,0.70970
+01/23/2010,0.70790
+01/24/2010,0.70770
+01/25/2010,0.70720
+01/26/2010,0.70650
+01/27/2010,0.7090
+01/28/2010,0.71130
+01/29/2010,0.71420
+01/30/2010,0.71760
+01/31/2010,0.72160
+02/01/2010,0.72160
+02/02/2010,0.71980
+02/03/2010,0.71760
+02/04/2010,0.71640
+02/05/2010,0.72240
+02/06/2010,0.73050
+02/07/2010,0.73130
+02/08/2010,0.73110
+02/09/2010,0.73170
+02/10/2010,0.7290
+02/11/2010,0.72670
+02/12/2010,0.72830
+02/13/2010,0.73350
+02/14/2010,0.73380
+02/15/2010,0.73390
+02/16/2010,0.73520
+02/17/2010,0.73050
+02/18/2010,0.73020
+02/19/2010,0.73620
+02/20/2010,0.73950
+02/21/2010,0.73490
+02/22/2010,0.73480
+02/23/2010,0.73490
+02/24/2010,0.73660
+02/25/2010,0.73820
+02/26/2010,0.74080
+02/27/2010,0.73530
+02/28/2010,0.7340
+03/01/2010,0.73380
+03/02/2010,0.73720
+03/03/2010,0.73790
+03/04/2010,0.7320
+03/05/2010,0.73370
+03/06/2010,0.73560
+03/07/2010,0.73420
+03/08/2010,0.73420
+03/09/2010,0.73240
+03/10/2010,0.7360
+03/11/2010,0.73450
+03/12/2010,0.73220
+03/13/2010,0.72760
+03/14/2010,0.72650
+03/15/2010,0.72650
+03/16/2010,0.72990
+03/17/2010,0.72870
+03/18/2010,0.72650
+03/19/2010,0.73260
+03/20/2010,0.73750
+03/21/2010,0.7390
+03/22/2010,0.73940
+03/23/2010,0.73940
+03/24/2010,0.73990
+03/25/2010,0.74840
+03/26/2010,0.75060
+03/27/2010,0.74740
+03/28/2010,0.7470
+03/29/2010,0.74550
+03/30/2010,0.74270
+03/31/2010,0.74330
+04/01/2010,0.74160
+04/02/2010,0.73920
+04/03/2010,0.73860
+04/04/2010,0.74110
+04/05/2010,0.74110
+04/06/2010,0.74140
+04/07/2010,0.74640
+04/08/2010,0.74830
+04/09/2010,0.75040
+04/10/2010,0.74520
+04/11/2010,0.7410
+04/12/2010,0.74090
+04/13/2010,0.7350
+04/14/2010,0.7360
+04/15/2010,0.73310
+04/16/2010,0.73670
+04/17/2010,0.73960
+04/18/2010,0.74090
+04/19/2010,0.74130
+04/20/2010,0.74320
+04/21/2010,0.74260
+04/22/2010,0.7460
+04/23/2010,0.74950
+04/24/2010,0.75120
+04/25/2010,0.74730
+04/26/2010,0.74740
+04/27/2010,0.74960
+04/28/2010,0.7520
+04/29/2010,0.75820
+04/30/2010,0.75550
+05/01/2010,0.75220
+05/02/2010,0.75270
+05/03/2010,0.75230
+05/04/2010,0.75670
+05/05/2010,0.76390
+05/06/2010,0.7750
+05/07/2010,0.78540
+05/08/2010,0.78650
+05/09/2010,0.78420
+05/10/2010,0.78310
+05/11/2010,0.77470
+05/12/2010,0.78680
+05/13/2010,0.79020
+05/14/2010,0.7940
+05/15/2010,0.80260
+05/16/2010,0.80940
+05/17/2010,0.80980
+05/18/2010,0.81120
+05/19/2010,0.80960
+05/20/2010,0.81520
+05/21/2010,0.80690
+05/22/2010,0.79650
+05/23/2010,0.79560
+05/24/2010,0.79550
+05/25/2010,0.80520
+05/26/2010,0.81570
+05/27/2010,0.81550
+05/28/2010,0.81310
+05/29/2010,0.81020
+05/30/2010,0.81510
+05/31/2010,0.81520
+06/01/2010,0.8130
+06/02/2010,0.81790
+06/03/2010,0.81820
+06/04/2010,0.81710
+06/05/2010,0.82740
+06/06/2010,0.83590
+06/07/2010,0.83610
+06/08/2010,0.83740
+06/09/2010,0.83710
+06/10/2010,0.83410
+06/11/2010,0.82830
+06/12/2010,0.82650
+06/13/2010,0.8260
+06/14/2010,0.82590
+06/15/2010,0.81780
+06/16/2010,0.81520
+06/17/2010,0.81260
+06/18/2010,0.81010
+06/19/2010,0.81010
+06/20/2010,0.80840
+06/21/2010,0.80720
+06/22/2010,0.80740
+06/23/2010,0.81370
+06/24/2010,0.81490
+06/25/2010,0.81190
+06/26/2010,0.81140
+06/27/2010,0.80880
+06/28/2010,0.80870
+06/29/2010,0.81090
+06/30/2010,0.81930
+07/01/2010,0.81640
+07/02/2010,0.8090
+07/03/2010,0.79770
+07/04/2010,0.79610
+07/05/2010,0.79620
Please sign in to comment.
Something went wrong with that request. Please try again.