website/src/MapPage/map.js
/**
       * Given an object of neighbors and their index and distance, returns a label and latent representing a generated image
       * @param {Int[]} ids: is array of obj ids,
       * @param {Float[]} distances: are the distances to those,
       * of the closest neighbors to a click, where the number of neighbors taken  were decided earlier in the stack
       */
Given an object of neighbors and their index and distance, returns a label and latent representing a generated image
@param {Int[]} ids: is array of obj ids,
@param {Float[]} distances: are the distances to those,
of the closest neighbors to a click, where the number of neighbors taken  were decided earlier in the stack
Given an object of neighbors and their index and distance returns a label and latent representing a generated image @param { Int [] } ids : is array of obj ids @param { Float [] } distances : are the distances to those of the closest neighbors to a click where the number of neighbors taken were decided earlier in the stack
function interpolateAndSet(ids, distances) {
        if (checkIfNotSuperClose(ids, distances)) {
            const ratios = Softmax(scalarMultiplyVector(distances, -6));
            let totalLatent = new Array(140).fill(0);
            let totalLabel = new Array(1000).fill(0);
            ratios.forEach(function (r, i) {
                const index = idToIndex[ids[i]];
                const labels = stateHolder.state.images[index].labels;
                const latents = stateHolder.state.images[index].latents;
                totalLatent = addVector(totalLatent, scalarMultiplyVector(latents, r));
                totalLabel = addVector(totalLabel, scalarMultiplyVector(labels, r));
            });
            getGenImage(`[[${totalLatent.toString()}]]`, totalLabel);
        }
    }
function interpolateAndSet ( ids , distances ) { if ( checkIfNotSuperClose ( ids , distances ) ) { const ratios = Softmax ( scalarMultiplyVector ( distances , - 6 ) ) ; let totalLatent = new Array ( 140 ) . fill ( 0 ) ; let totalLabel = new Array ( 1000 ) . fill ( 0 ) ; ratios . forEach ( function ( r , i ) { const index = idToIndex [ ids [ i ] ] ; const labels = stateHolder . state . images [ index ] . labels ; const latents = stateHolder . state . images [ index ] . latents ; totalLatent = addVector ( totalLatent , scalarMultiplyVector ( latents , r ) ) ; totalLabel = addVector ( totalLabel , scalarMultiplyVector ( labels , r ) ) ; } ) ; getGenImage ( ` ${ totalLatent . toString ( ) } ` , totalLabel ) ; } }
Given an object of neighbors and their index and distance, returns a label and latent representing a generated image
 @param {Int[]} ids: is array of obj ids,
 @param {Float[]} distances: are the distances to those,
 of the closest neighbors to a click, where the number of neighbors taken  were decided earlier in the stack
Given an object of neighbors and their index and distance returns a label and latent representing a generated image @param { Int [] } ids : is array of obj ids @param { Float [] } distances : are the distances to those of the closest neighbors to a click where the number of neighbors taken were decided earlier in the stack