js/tsne_vis.js
// Normalize distances to prevent numerical issues.
Normalize distances to prevent numerical issues.
Normalize distances to prevent numerical issues .
function normDist(data, dist) {
  var max_dist = 0;
  for(var i = 0; i < data.length; i++) {
    for(var j = i + 1; j < data.length; j++) {
      if(dist[i][j] > max_dist) max_dist = dist[i][j];
    }
  }
  for(var i = 0; i < data.length; i++) {
    for(var j = 0; j < data.length; j++) {
      dist[i][j] /= max_dist;
    }
  }
  return dist;
}
function normDist ( data , dist ) { var max_dist = 0 ; for ( var i = 0 ; i < data . length ; i ++ ) { for ( var j = i + 1 ; j < data . length ; j ++ ) { if ( dist [ i ] [ j ] > max_dist ) max_dist = dist [ i ] [ j ] ; } } for ( var i = 0 ; i < data . length ; i ++ ) { for ( var j = 0 ; j < data . length ; j ++ ) { dist [ i ] [ j ] /= max_dist ; } } return dist ; }
Normalize distances to prevent numerical issues.
Normalize distances to prevent numerical issues .