Enable Remigijus's Barnes-Hut
This commit is contained in:
@@ -15,7 +15,7 @@ function starttSNE() {
|
|||||||
// The distance function that will be used to calculate distances
|
// The distance function that will be used to calculate distances
|
||||||
// between nodes.
|
// between nodes.
|
||||||
.distance(function (s, t) {
|
.distance(function (s, t) {
|
||||||
return distanceFunction(s, t, props, norm) * MULTIPLIER;
|
return distanceFunction(s, t, props, norm);
|
||||||
}));
|
}));
|
||||||
// Restart the simulation.
|
// Restart the simulation.
|
||||||
console.log(simulation.force(forceName).perplexity(), simulation.force(forceName).learningRate());
|
console.log(simulation.force(forceName).perplexity(), simulation.force(forceName).learningRate());
|
||||||
@@ -26,18 +26,19 @@ function starttSNE() {
|
|||||||
* Initialize the Barnes-Hut algorithm and start simulation.
|
* Initialize the Barnes-Hut algorithm and start simulation.
|
||||||
*/
|
*/
|
||||||
function startBarnesHutSimulation() {
|
function startBarnesHutSimulation() {
|
||||||
|
console.log("startBarnesHutSimulation")
|
||||||
|
alreadyRanIterations = 0;
|
||||||
|
manualStop = false;
|
||||||
springForce = false;
|
springForce = false;
|
||||||
simulation.stop();
|
|
||||||
p1 = performance.now();
|
p1 = performance.now();
|
||||||
|
|
||||||
simulation
|
simulation.alphaDecay(1 - Math.pow(0.001, 1 / ITERATIONS))
|
||||||
.alphaDecay(1 - Math.pow(0.001, 1 / ITERATIONS))
|
.on("tick", ticked)
|
||||||
|
.on("end", ended)
|
||||||
.force(forceName, d3.forceBarnesHut()
|
.force(forceName, d3.forceBarnesHut()
|
||||||
// The distance function that will be used to calculate distances
|
// The distance function that will be used to calculate distances
|
||||||
// between nodes.
|
// between nodes.
|
||||||
.distance(function (s, t) {
|
.distance(function(s, t) { return distanceFunction(s, t, props, norm); }));
|
||||||
return distanceFunction(s, t, props, norm) * MULTIPLIER;
|
|
||||||
}));
|
|
||||||
// Restart the simulation.
|
// Restart the simulation.
|
||||||
simulation.alpha(1).restart();
|
simulation.alpha(1).restart();
|
||||||
}
|
}
|
||||||
|
|||||||
4
index.js
4
index.js
@@ -1,9 +1,9 @@
|
|||||||
export {default as forceNeighbourSampling}
|
export {default as forceNeighbourSampling}
|
||||||
from "./src/neighbourSampling";
|
from "./src/neighbourSampling";
|
||||||
/*
|
|
||||||
export { default as forceBarnesHut}
|
export { default as forceBarnesHut}
|
||||||
from "./src/barnesHut";
|
from "./src/barnesHut";
|
||||||
|
/*
|
||||||
export { default as tSNE}
|
export { default as tSNE}
|
||||||
from "./src/t-sne";
|
from "./src/t-sne";
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user