js/tsne_vis.js
// Parse the data set with the use of PapaParse.
Parse the data set with the use of PapaParse.
Parse the data set with the use of PapaParse .
function parseData(url) {
  var graphDiv = 'gridVisual'
  Plotly.purge(graphDiv);
  document.getElementById("loader").style.display = "block";
  Papa.parse(url, { 
      download: true,
      header: true,
      dynamicTyping: true,
      skipEmptyLines: true,
      complete: function(results) {
        results.data = results.data.filter(function (el) {
        var counter = 0;
        for(key in el) {
            if(el.hasOwnProperty(key)) {
                var value = el[key];
                  if(key === "id" || key === "Version" || typeof(value) !== 'number' || value === undefined){ 
                    delete el[key];
                  }else{
                    el[counter] = el[key];
                    delete el[key];
                    counter = counter + 1;
                  }
            }
        }
        return el;
        });
        Papa.parse(url, { 
            download: true,
            header: true,
            dynamicTyping: true,
            skipEmptyLines: true,
            complete: function(data) {
              doStuff(data.data.filter(function (el) {
                  var counter = 0;
                  for(key in el) {
                      if(el.hasOwnProperty(key)) {
                          var value = el[key];
                            if(key === "id" || key === "Version"){ 
                              delete el[key];
                            }
                      }
                  }
                  return el;
                  }));
            }
          });
          function doStuff(results_all){
            results_all_global = results_all
            if (mode == 2) {
                if (insideCall) {
                  init(results.data, results_all, results.meta.fields); 
                } else {
                  $.post(BACKEND_API_URL+"/resetAll", JSON.stringify(''), function(){
                  });
                  var parametersLocal = []
                  parametersLocal.push(document.getElementById("param-perplexity-value").value)
                  parametersLocal.push(document.getElementById("param-learningrate-value").value)
                  parametersLocal.push(document.getElementById("param-maxiter-value").value)
                  parametersLocal.push(results_all)
                  $.post(BACKEND_API_URL+"/receiverSingle", JSON.stringify(parametersLocal), function(){
                    $.get(BACKEND_API_URL+"/senderSingle", function( data ) {
                      dataReceivedFromServer = data
                      projections = dataReceivedFromServer['projections']
                      betas = dataReceivedFromServer['betas']
                      cost_per_point = dataReceivedFromServer['cpp']
                      cost_overall = dataReceivedFromServer['cpi']
                      activeProjectionNumber = 0
                      activeProjectionNumberProv = 0
                      init(results.data, results_all, results.meta.fields); 
                  });
                });
              }
            } else {
              if (flagAnalysis) {
                $('#myModal').modal('hide');
                $.post(BACKEND_API_URL+"/resetAll", JSON.stringify(''), function(){
                  });
                  var parametersLocal = []
                  parametersLocal.push(document.getElementById("param-perplexity-value").value)
                  parametersLocal.push(document.getElementById("param-learningrate-value").value)
                  parametersLocal.push(document.getElementById("param-maxiter-value").value)
                  parametersLocal.push(results_all)
                  $.post(BACKEND_API_URL+"/receiverSingle", JSON.stringify(parametersLocal), function(){
                    $.get(BACKEND_API_URL+"/senderSingle", function( data ) {
                      dataReceivedFromServer = data
                      projections = dataReceivedFromServer['projections']
                      betas = dataReceivedFromServer['betas']
                      cost_per_point = dataReceivedFromServer['cpp']
                      cost_overall = dataReceivedFromServer['cpi']
                      activeProjectionNumber = 0
                      init(results.data, results_all, results.meta.fields); 
                  });
                });
              } else {
                    $.post(BACKEND_API_URL+"/resetAll", JSON.stringify(''), function(){
                    });
                    $.post(BACKEND_API_URL+"/receiver", JSON.stringify(results_all), function(){
                      $.get(BACKEND_API_URL+"/sender", function( data ) {
                        dataReceivedFromServer = data
                        ReSortOver()
                  });
                });
              }
        }
          }
      }
    });
}
function parseData ( url ) { var graphDiv = 'gridVisual' Plotly . purge ( graphDiv ) ; document . getElementById ( "loader" ) . style . display = "block" ; Papa . parse ( url , { download : true , header : true , dynamicTyping : true , skipEmptyLines : true , complete : function ( results ) { results . data = results . data . filter ( function ( el ) { var counter = 0 ; for ( key in el ) { if ( el . hasOwnProperty ( key ) ) { var value = el [ key ] ; if ( key === "id" || key === "Version" || typeof ( value ) !== 'number' || value === undefined ) { delete el [ key ] ; } else { el [ counter ] = el [ key ] ; delete el [ key ] ; counter = counter + 1 ; } } } return el ; } ) ; Papa . parse ( url , { download : true , header : true , dynamicTyping : true , skipEmptyLines : true , complete : function ( data ) { doStuff ( data . data . filter ( function ( el ) { var counter = 0 ; for ( key in el ) { if ( el . hasOwnProperty ( key ) ) { var value = el [ key ] ; if ( key === "id" || key === "Version" ) { delete el [ key ] ; } } } return el ; } ) ) ; } } ) ; function doStuff ( results_all ) { results_all_global = results_all if ( mode == 2 ) { if ( insideCall ) { init ( results . data , results_all , results . meta . fields ) ; } else { $ . post ( BACKEND_API_URL + "/resetAll" , JSON . stringify ( '' ) , function ( ) { } ) ; var parametersLocal = [ ] parametersLocal . push ( document . getElementById ( "param-perplexity-value" ) . value ) parametersLocal . push ( document . getElementById ( "param-learningrate-value" ) . value ) parametersLocal . push ( document . getElementById ( "param-maxiter-value" ) . value ) parametersLocal . push ( results_all ) $ . post ( BACKEND_API_URL + "/receiverSingle" , JSON . stringify ( parametersLocal ) , function ( ) { $ . get ( BACKEND_API_URL + "/senderSingle" , function ( data ) { dataReceivedFromServer = data projections = dataReceivedFromServer [ 'projections' ] betas = dataReceivedFromServer [ 'betas' ] cost_per_point = dataReceivedFromServer [ 'cpp' ] cost_overall = dataReceivedFromServer [ 'cpi' ] activeProjectionNumber = 0 activeProjectionNumberProv = 0 init ( results . data , results_all , results . meta . fields ) ; } ) ; } ) ; } } else { if ( flagAnalysis ) { $ ( '#myModal' ) . modal ( 'hide' ) ; $ . post ( BACKEND_API_URL + "/resetAll" , JSON . stringify ( '' ) , function ( ) { } ) ; var parametersLocal = [ ] parametersLocal . push ( document . getElementById ( "param-perplexity-value" ) . value ) parametersLocal . push ( document . getElementById ( "param-learningrate-value" ) . value ) parametersLocal . push ( document . getElementById ( "param-maxiter-value" ) . value ) parametersLocal . push ( results_all ) $ . post ( BACKEND_API_URL + "/receiverSingle" , JSON . stringify ( parametersLocal ) , function ( ) { $ . get ( BACKEND_API_URL + "/senderSingle" , function ( data ) { dataReceivedFromServer = data projections = dataReceivedFromServer [ 'projections' ] betas = dataReceivedFromServer [ 'betas' ] cost_per_point = dataReceivedFromServer [ 'cpp' ] cost_overall = dataReceivedFromServer [ 'cpi' ] activeProjectionNumber = 0 init ( results . data , results_all , results . meta . fields ) ; } ) ; } ) ; } else { $ . post ( BACKEND_API_URL + "/resetAll" , JSON . stringify ( '' ) , function ( ) { } ) ; $ . post ( BACKEND_API_URL + "/receiver" , JSON . stringify ( results_all ) , function ( ) { $ . get ( BACKEND_API_URL + "/sender" , function ( data ) { dataReceivedFromServer = data ReSortOver ( ) } ) ; } ) ; } } } } } ) ; }
Parse the data set with the use of PapaParse.
Parse the data set with the use of PapaParse .
// Add more limitations if needed in both areas. This is for the calculations so  it needs more limitations! // Add more limitations if needed in both areas. Key limitations here! // results_all variable is all the columns multiplied by all the rows. // results.data variable is all the columns except strings, undefined values, or "Version" plus beta and cost values." // results.meta.fields variable is all the features (columns) plus beta and cost strings.   // Call the init() function that starts everything! // Call the init() function that starts everything! // Call the init() function that starts everything! // ajax the JSON to the server