-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
Missed this in my review of #1901. The state management performed by
clients of computeKnn
is incorrect. The intent was that computeKnn
should manage the this.nearest
field entirely. Assignments on lines
361 and 384, and dereferences on 363, 387, and 388, are wrong:
tensorboard/tensorboard/plugins/projector/vz_projector/data.ts
Lines 358 to 365 in 9270699
const knnComputation = this.computeKnn(sampledData, k) | |
knnComputation.then(nearest => { | |
this.nearest = nearest; | |
util.runAsyncTask('Initializing T-SNE...', () => { | |
this.tsne.initDataDist(this.nearest); | |
}).then(step); | |
}); |
tensorboard/tensorboard/plugins/projector/vz_projector/data.ts
Lines 384 to 388 in 9270699
this.nearest = await this.computeKnn(sampledData, nNeighbors); | |
const nEpochs = await util.runAsyncTask('Initializing UMAP...', () => { | |
const knnIndices = this.nearest.map(row => row.map(entry => entry.index)); | |
const knnDistances = this.nearest.map(row => |
The correct invocations should simply be:
const knnComputation = this.computeKnn(sampledData, k)
knnComputation.then(nearest => {
util.runAsyncTask('Initializing T-SNE...', () => {
this.tsne.initDataDist(nearest);
}).then(step);
});
const nearest = await this.computeKnn(sampledData, nNeighbors);
const nEpochs = await util.runAsyncTask('Initializing UMAP...', () => {
const knnIndices = nearest.map(row => row.map(entry => entry.index));
const knnDistances = nearest.map(row =>
This probably doesn’t have any observable effects at this time, because
the assignments should all be trivial and the reads should always be
reading something up-to-date, but this is still an error and should be
fixed.