axWeight +
            duration * durationWeight + confidence * confidenceWeight;
        return distance;
    }

    function dynamicCalculateNearestNeighbors(type) {
        var count = 0;
        var targetBranchCount = track.analysis[type].length / 6;

        precalculateNearestNeighbors(type, jukeboxData.maxBranches, jukeboxData.maxBranchThreshold);

        for (var threshold = 10; threshold < jukeboxData.maxBranchThreshold; threshold += 5) {
            count = collectNearestNeighbors(type, threshol