Comparing compute and iterable t-SNE
Hi,
I am developing a brief interface where user can select if compute t-SNE at once or observe the iterations. Unfortunately, I am not able to obtain comparable results using the base code published in the MANIFEST. I am using the Iris data.
var tsneOpt = tsne.tsne( tensorData, { perplexity : PERPLEXITY } );
// This is the 'compute' version tsneOpt.compute( ITERATIONS ).then( () => { tsneOpt.coordsArray().then( coords => { console.log( 'Projection finished!' ); coords.forEach( ( d, i ) => { data[ i ].x = d[ 0 ]; data[ i ].y = d[ 1 ]; } ); drawProjection(); } ); } );
// This is the iterable version
async function iterateProjection() {
await tsneOpt.iterateKnn();
const step = 20;
for( let i = 0; i < ITERATIONS; i += step ) {
await tsneOpt.iterate( step );
tsneOpt.coordsArray().then( coords => {
console.log( 'Projection stepped!' );
coords.forEach( ( d, i ) => {
data[ i ].x = d[ 0 ];
data[ i ].y = d[ 1 ];
} );
drawProjection();
} );
}
}
Thank you in advance!