HDIM  1.0.0
Packages for High Dimensional Linear Regression
test_fos.js
1 var tools = require( "./fos.js" )
2 
3 var fos = new tools.FOS();
4 
5 var vectorized_X = new tools.VectorDouble();
6 
7 var n = 20;
8 var p = 50;
9 
10 for ( i = 0; i < n * p ; i++ ) {
11  vectorized_X.push_back( Math.random() );
12 }
13 
14 var Y = new tools.VectorDouble();
15 
16 for ( i = 0; i < n * 1 ; i++ ) {
17  Y.push_back( Math.random() );
18 }
19 
20 var start = +(new Date);
21 fos.Run( vectorized_X, Y, "cd" )
22 var end = +(new Date);
23 var difference = end - start;
24 
25 console.log( "Approximate execution time (ms): ", difference );
26 
27 var coefs = fos.ReturnCoefficients();
28 var intercept = fos.ReturnIntercept();
29 
30 console.log( "Intercept: ", intercept );
31 
32 console.log( "Beta Vector:" );
33 
34 for ( i = 0; i < coefs.size() ; i++ ) {
35  console.log( coefs.get(i) );
36 }