demo/js/automatic.js
function makeDataset(arr, colstats) {

    var labelix = parseInt($("#labelix").val());
    if(labelix < 0) labelix = D + labelix; // -1 should turn to D-1

    var data = [];
    var labels = [];
    for(var i=0;i<N;i++) {
      var arri = arr[i];
      
      // create the input datapoint Vol()
      var p = arri.slice(0, D-1);
      var xarr = [];
      for(var j=0;j<D;j++) {
        if(j===labelix) continue; // skip!

        if(colstats[j].numeric) {
          xarr.push(parseFloat(arri[j]));
        } else {
          var u = colstats[j].uniques;
          var ix = u.indexOf(arri[j]); // turn into 1ofk encoding
          for(var q=0;q<u.length;q++) {
            if(q === ix) { xarr.push(1.0); }
            else { xarr.push(0.0); }
          }
        }
      }
      var x = new convnetjs.Vol(xarr);
      
      // process the label (last column)
      if(colstats[labelix].numeric) {
        var L = parseFloat(arri[labelix]); // regression
      } else {
        var L = colstats[labelix].uniques.indexOf(arri[labelix]); // classification
        if(L==-1) {
          console.log('whoa label not found! CRITICAL ERROR, very fishy.');
        }
      }
      data.push(x);
      labels.push(L);
    }
    
    var dataset = {};
    dataset.data = data;
    dataset.labels = labels;
    return dataset;
  }
function makeDataset(arr, colstats) {

    var labelix = parseInt($("#labelix").val());
    if(labelix < 0) labelix = D + labelix; // -1 should turn to D-1

    var data = [];
    var labels = [];
    for(var i=0;i<N;i++) {
      var arri = arr[i];
      
      // create the input datapoint Vol()
      var p = arri.slice(0, D-1);
      var xarr = [];
      for(var j=0;j<D;j++) {
        if(j===labelix) continue; // skip!

        if(colstats[j].numeric) {
          xarr.push(parseFloat(arri[j]));
        } else {
          var u = colstats[j].uniques;
          var ix = u.indexOf(arri[j]); // turn into 1ofk encoding
          for(var q=0;q<u.length;q++) {
            if(q === ix) { xarr.push(1.0); }
            else { xarr.push(0.0); }
          }
        }
      }
      var x = new convnetjs.Vol(xarr);
      
      // process the label (last column)
      if(colstats[labelix].numeric) {
        var L = parseFloat(arri[labelix]); // regression
      } else {
        var L = colstats[labelix].uniques.indexOf(arri[labelix]); // classification
        if(L==-1) {
          console.log('whoa label not found! CRITICAL ERROR, very fishy.');
        }
      }
      data.push(x);
      labels.push(L);
    }
    
    var dataset = {};
    dataset.data = data;
    dataset.labels = labels;
    return dataset;
  }
function makeDataset ( arr , colstats ) { var labelix = parseInt ( $ ( "#labelix" ) . val ( ) ) ; if ( labelix < 0 ) labelix = D + labelix ; // -1 should turn to D-1 var data = [ ] ; var labels = [ ] ; for ( var i = 0 ; i < N ; i ++ ) { var arri = arr [ i ] ; // create the input datapoint Vol() var p = arri . slice ( 0 , D - 1 ) ; var xarr = [ ] ; for ( var j = 0 ; j < D ; j ++ ) { if ( j === labelix ) continue ; // skip! if ( colstats [ j ] . numeric ) { xarr . push ( parseFloat ( arri [ j ] ) ) ; } else { var u = colstats [ j ] . uniques ; var ix = u . indexOf ( arri [ j ] ) ; // turn into 1ofk encoding for ( var q = 0 ; q < u . length ; q ++ ) { if ( q === ix ) { xarr . push ( 1.0 ) ; } else { xarr . push ( 0.0 ) ; } } } } var x = new convnetjs . Vol ( xarr ) ; // process the label (last column) if ( colstats [ labelix ] . numeric ) { var L = parseFloat ( arri [ labelix ] ) ; // regression } else { var L = colstats [ labelix ] . uniques . indexOf ( arri [ labelix ] ) ; // classification if ( L == - 1 ) { console . log ( 'whoa label not found! CRITICAL ERROR, very fishy.' ) ; } } data . push ( x ) ; labels . push ( L ) ; } var dataset = { } ; dataset . data = data ; dataset . labels = labels ; return dataset ; }
process input mess into vols and labels
process input mess into vols and labels