Enable Remigijus's Barnes-Hut

This commit is contained in:
Pitchaya Boonsarngsuk
2018-02-02 12:19:17 +00:00
parent f6ac1f7e37
commit 474bd677ae
2 changed files with 13 additions and 12 deletions

View File

@@ -15,7 +15,7 @@ function starttSNE() {
// The distance function that will be used to calculate distances
// between nodes.
.distance(function (s, t) {
return distanceFunction(s, t, props, norm) * MULTIPLIER;
return distanceFunction(s, t, props, norm);
}));
// Restart the simulation.
console.log(simulation.force(forceName).perplexity(), simulation.force(forceName).learningRate());
@@ -26,18 +26,19 @@ function starttSNE() {
* Initialize the Barnes-Hut algorithm and start simulation.
*/
function startBarnesHutSimulation() {
console.log("startBarnesHutSimulation")
alreadyRanIterations = 0;
manualStop = false;
springForce = false;
simulation.stop();
p1 = performance.now();
simulation
.alphaDecay(1 - Math.pow(0.001, 1 / ITERATIONS))
.force(forceName, d3.forceBarnesHut()
// The distance function that will be used to calculate distances
// between nodes.
.distance(function (s, t) {
return distanceFunction(s, t, props, norm) * MULTIPLIER;
}));
simulation.alphaDecay(1 - Math.pow(0.001, 1 / ITERATIONS))
.on("tick", ticked)
.on("end", ended)
.force(forceName, d3.forceBarnesHut()
// The distance function that will be used to calculate distances
// between nodes.
.distance(function(s, t) { return distanceFunction(s, t, props, norm); }));
// Restart the simulation.
simulation.alpha(1).restart();
}