!function(){vart={8511:function(t){function_typeof(t){return_typeof="function"===typeofSymbol&&"symbol"===typeofSymbol.iterator?function_typeof(t){returntypeoft}:function_typeof(t){returnt&&"function"===typeofSymbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeoft},_typeof(t)}functionDBSCAN(t,r,o,i){this.dataset=[],this.epsilon=1,this.minPts=2,this.distance=this._euclideanDistance,this.clusters=[],this.noise=[],this._visited=[],this._assigned=[],this._datasetLength=0,this._init(t,r,o,i)}DBSCAN.prototype.run=function(t,r,o,i){this._init(t,r,o,i);for(vara=0;a<this._datasetLength;a++)if(1!==this._visited[a]){this._visited[a]=1;varu=this._regionQuery(a);if(u.length<this.minPts)this.noise.push(a);else{varc=this.clusters.length;this.clusters.push([]),this._addToCluster(a,c),this._expandCluster(c,u)}}returnthis.clusters},DBSCAN.prototype._init=function(t,r,o,i){if(t){if(!(tinstanceofArray))throwError("Dataset must be of type array, "+_typeof(t)+" given");this.dataset=t,this.clusters=[],this.noise=[],this._datasetLength=t.length,this._visited=newArray(this._datasetLength),this._assigned=newArray(this._datasetLength)}r&&(this.epsilon=r),o&&(this.minPts=o),i&&(this.distance=i)},DBSCAN.prototype._expandCluster=function(t,r){for(varo=0;o<r.length;o++){vari=r[o];if(1!==this._visited[i]){this._visited[i]=1;vara=this._regionQuery(i);a.length>=this.minPts&&(r=this._mergeArrays(r,a))}1!==this._assigned[i]&&this._addToCluster(i,t)}},DBSCAN.prototype._addToCluster=function(t,r){this.clusters[r].push(t),this._assigned[t]=1},DBSCAN.prototype._regionQuery=function(t){for(varr=[],o=0;o<this._datasetLength;o++){this.distance(this.dataset[t],this.dataset[o])<this.epsilon&&r.push(o)}returnr},DBSCAN.prototype._mergeArrays=function(t,r){for(varo=r.length,i=0;i<o;i++){vara=r[i];t.indexOf(a)<0&&t.push(a)}returnt},DBSCAN.prototype._euclideanDistance=function(t,r){for(varo=0,i=Math.min(t.length,r.length);i--;)o+=(t[i]-r[i])*(t[i]-r[i]);returnMath.sqrt(o)},t.exports&&(t.exports=DBSCAN)},4900:function(t){functionKMEANS(t,r,o){this.k=3,this.dataset=[],this.assignments=[],this.centroids=[],this.init(t,r,o)}KMEANS.prototype.init=function(t,r,o){this.assignments=[],this.centroids=[],"undefined"!==typeoft&&(this.dataset=t),"undefined"!==typeofr&&(this.k=r),"undefined"!==typeofo&&(this.distance=o)},KMEANS.prototype.run=function(t,r){this.init(t,r);for(varo=this.dataset.length,i=0;i<this.k;i++)this.centroids[i]=this.randomCentroid();for(vara=!0;a;){a=this.assign();for(varu=0;u<this.k;u++){for(varc=newArray(h),l=0,p=0;p<h;p++)c[p]=0;for(vard=0;d<o;d++){varh=this.dataset[d].length;if(u===this.assignments[d]){for(p=0;p<h;p++)c[p]+=this.dataset[d][p];l++}}if(l>0){for(p=0;p<h;p++)c[p]/=l;this.centroids[u]=c}elsethis.centroids[u]=this.randomCentroid(),a=!0}}returnthis.getClusters()},KMEANS.prototype.randomCentroid=function(){vart,r,o=this.dataset.length-1;do{r=Math.round(Math.random()*o),t=this.dataset[r]}while(this.centroids.indexOf(t)>=0);returnt},KMEANS.prototype.assign=function(){for(vart,r=!1,o=this.dataset.length,i=0;i<o;i++)(t=this.argmin(this.dataset[i],this.centroids,this.distance))!=this.assignments[i]&&(this.assignments[i]=t,r=!0);returnr},KMEANS.prototype.getClusters=function(){for(vart,r=newArray(this.k),o=0;o<this.assignments.length;o++)"undefined"===typeofr[t=this.assignments[o]]&&(r[t]=[]),r[t].push(o);returnr},KMEANS.prototype.argmin=function(t,r,o){for(vari,a=Number.MAX_VALUE,u=0,c=r.length,l=0;l<c;l++)(i=o(t,r[l]))<a&&(a=i,u=l);returnu},KMEANS.prototype.distance=function(t,r){for(varo=0,i=Math.min(t.length,r.length);i--;){vara=t[i]-r[i];o+=a*a}returnMath.sqrt(o)},t.exports&&(t.exports=KMEANS)},9593:function(t,r,o){function_typeof(t){return_typeof="function"===typeofSymbol&&"symbol"===typeofSymbol.iterator?function_typeof(t){returntypeoft}:function_typeof(t){returnt&&"function"===typeofSymbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeoft},_typeof(t)}if(t.exports)vari=o(3632);functionOPTICS(t,r,o,i){this.epsilon=1,this.minPts=1,this.distance=this._e