@datagrok/eda 1.3.4 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/dist/111.js +1 -1
- package/dist/111.js.map +1 -1
- package/dist/128.js +1 -1
- package/dist/128.js.map +1 -1
- package/dist/153.js +1 -1
- package/dist/153.js.map +1 -1
- package/dist/23.js +1 -1
- package/dist/23.js.map +1 -1
- package/dist/234.js +1 -1
- package/dist/234.js.map +1 -1
- package/dist/242.js +1 -1
- package/dist/242.js.map +1 -1
- package/dist/260.js +1 -1
- package/dist/260.js.map +1 -1
- package/dist/33.js +1 -1
- package/dist/33.js.map +1 -1
- package/dist/348.js +1 -1
- package/dist/348.js.map +1 -1
- package/dist/377.js +1 -1
- package/dist/377.js.map +1 -1
- package/dist/412.js +1 -1
- package/dist/412.js.map +1 -1
- package/dist/415.js +1 -1
- package/dist/415.js.map +1 -1
- package/dist/531.js +1 -1
- package/dist/531.js.map +1 -1
- package/dist/583.js +1 -1
- package/dist/583.js.map +1 -1
- package/dist/589.js +1 -1
- package/dist/589.js.map +1 -1
- package/dist/603.js +1 -1
- package/dist/603.js.map +1 -1
- package/dist/656.js +1 -1
- package/dist/656.js.map +1 -1
- package/dist/682.js +1 -1
- package/dist/682.js.map +1 -1
- package/dist/705.js +1 -1
- package/dist/705.js.map +1 -1
- package/dist/727.js +1 -1
- package/dist/727.js.map +1 -1
- package/dist/731.js +1 -1
- package/dist/731.js.map +1 -1
- package/dist/738.js +1 -1
- package/dist/738.js.map +1 -1
- package/dist/763.js +1 -1
- package/dist/763.js.map +1 -1
- package/dist/778.js +1 -1
- package/dist/778.js.map +1 -1
- package/dist/783.js +1 -1
- package/dist/783.js.map +1 -1
- package/dist/793.js +1 -1
- package/dist/793.js.map +1 -1
- package/dist/810.js +2 -0
- package/dist/810.js.map +1 -0
- package/dist/860.js +1 -1
- package/dist/860.js.map +1 -1
- package/dist/907.js +1 -1
- package/dist/907.js.map +1 -1
- package/dist/950.js +1 -1
- package/dist/950.js.map +1 -1
- package/dist/980.js +1 -1
- package/dist/980.js.map +1 -1
- package/dist/990.js +1 -1
- package/dist/990.js.map +1 -1
- package/dist/package-test.js +1 -1
- package/dist/package-test.js.map +1 -1
- package/dist/package.js +1 -1
- package/dist/package.js.map +1 -1
- package/package.json +6 -6
- package/src/package.ts +1 -1
- package/src/pls/pls-constants.ts +7 -7
- package/src/pls/pls-tools.ts +5 -13
- package/test-console-output-1.log +0 -343
- package/test-record-1.mp4 +0 -0
package/dist/415.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkeda=self.webpackChunkeda||[]).push([[415],{1853:function(t,e,r){var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.hasOwnProperty.call(t,r)&&n(e,t,r);return i(e,t),e};Object.defineProperty(e,"__esModule",{value:!0}),e.smallestFlagged=e.deheapSort=e.buildCandidates=e.uncheckedHeapPush=e.heapPush=e.rejectionSample=e.makeHeap=void 0;var o=a(r(8186));function s(t,e){var r=function(r){return o.empty(t).map((function(){return o.filled(e,r)}))},n=[];return n.push(r(-1)),n.push(r(1/0)),n.push(r(0)),n}function u(t,e,r,n,i){e=Math.floor(e);var a=t[0][e],o=t[1][e];if(t[2][e],r>=o[0])return 0;for(var s=0;s<a.length;s++)if(n===a[s])return 0;return h(t,e,r,n,i)}function h(t,e,r,n,i){var a=t[0][e],o=t[1][e],s=t[2][e];if(r>=o[0])return 0;o[0]=r,a[0]=n,s[0]=i;for(var u=0,h=0;;){var l=2*u+1,c=l+1,f=t[0][0].length;if(l>=f)break;if(c>=f){if(!(o[l]>r))break;h=l}else if(o[l]>=o[c]){if(!(r<o[l]))break;h=l}else{if(!(r<o[c]))break;h=c}o[u]=o[h],a[u]=a[h],s[u]=s[h],u=h}return o[u]=r,a[u]=n,s[u]=i,1}function l(t,e,r,n){for(;2*n+1<r;){var i=2*n+1,a=i+1,o=n;if(t[o]<t[i]&&(o=i),a<r&&t[o]<t[a]&&(o=a),o===n)break;var s=t[n];t[n]=t[o],t[o]=s;var u=e[n];e[n]=e[o],e[o]=u,n=o}}e.makeHeap=s,e.rejectionSample=function(t,e,r){for(var n=o.zeros(t),i=0;i<t;i++){for(var a=!0,s=0;a;){s=o.tauRandInt(e,r);for(var u=!1,h=0;h<i;h++)if(s===n[h]){u=!0;break}u||(a=!1)}n[i]=s}return n},e.heapPush=u,e.uncheckedHeapPush=h,e.buildCandidates=function(t,e,r,n,i){for(var a=s(e,n),h=0;h<e;h++)for(var l=0;l<r;l++)if(!(t[0][h][l]<0)){var c=t[0][h][l],f=t[2][h][l],p=o.tauRand(i);u(a,h,p,c,f),u(a,c,p,h,f),t[2][h][l]=0}return a},e.deheapSort=function(t){for(var e=t[0],r=t[1],n=0;n<e.length;n++)for(var i=e[n],a=r[n],o=0;o<i.length-1;o++){var s=i.length-o-1,u=a.length-o-1,h=i[0];i[0]=i[s],i[s]=h;var c=a[0];a[0]=a[u],a[u]=c,l(a,i,u,0)}return{indices:e,weights:r}},e.smallestFlagged=function(t,e){for(var r=t[0][e],n=t[1][e],i=t[2][e],a=1/0,o=-1,s=0;s>r.length;s++)1===i[s]&&n[s]<a&&(a=n[s],o=s);return o>=0?(i[o]=0,Math.floor(r[o])):-1}},2415:(t,e,r)=>{var n=r(5112);Object.defineProperty(e,"Q",{enumerable:!0,get:function(){return n.UMAP}})},702:function(t,e,r){var n,i=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),a=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.hasOwnProperty.call(t,r)&&i(e,t,r);return a(e,t),e},s=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,i,a=r.call(t),o=[];try{for(;(void 0===e||e-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o},u=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.getCSR=e.normalize=e.eliminateZeros=e.multiplyScalar=e.maximum=e.subtract=e.add=e.pairwiseMultiply=e.identity=e.transpose=e.SparseMatrix=void 0;var h=o(r(8186)),l=function(){function t(t,e,r,n){if(this.entries=new Map,this.nRows=0,this.nCols=0,t.length!==e.length||t.length!==r.length)throw new Error("rows, cols and values arrays must all have the same length");this.nRows=n[0],this.nCols=n[1];for(var i=0;i<r.length;i++){var a=t[i],o=e[i];this.checkDims(a,o);var s=this.makeKey(a,o);this.entries.set(s,{value:r[i],row:a,col:o})}}return t.prototype.makeKey=function(t,e){return t+":"+e},t.prototype.checkDims=function(t,e){if(!(t<this.nRows&&e<this.nCols))throw new Error("row and/or col specified outside of matrix dimensions")},t.prototype.set=function(t,e,r){this.checkDims(t,e);var n=this.makeKey(t,e);this.entries.has(n)?this.entries.get(n).value=r:this.entries.set(n,{value:r,row:t,col:e})},t.prototype.get=function(t,e,r){void 0===r&&(r=0),this.checkDims(t,e);var n=this.makeKey(t,e);return this.entries.has(n)?this.entries.get(n).value:r},t.prototype.getAll=function(t){void 0===t&&(t=!0);var e=[];return this.entries.forEach((function(t){e.push(t)})),t&&e.sort((function(t,e){return t.row===e.row?t.col-e.col:t.row-e.row})),e},t.prototype.getDims=function(){return[this.nRows,this.nCols]},t.prototype.getRows=function(){return Array.from(this.entries,(function(t){var e=s(t,2);return e[0],e[1].row}))},t.prototype.getCols=function(){return Array.from(this.entries,(function(t){var e=s(t,2);return e[0],e[1].col}))},t.prototype.getValues=function(){return Array.from(this.entries,(function(t){var e=s(t,2);return e[0],e[1].value}))},t.prototype.forEach=function(t){this.entries.forEach((function(e){return t(e.value,e.row,e.col)}))},t.prototype.map=function(e){var r=[];this.entries.forEach((function(t){r.push(e(t.value,t.row,t.col))}));var n=[this.nRows,this.nCols];return new t(this.getRows(),this.getCols(),r,n)},t.prototype.toArray=function(){var t=this,e=h.empty(this.nRows).map((function(){return h.zeros(t.nCols)}));return this.entries.forEach((function(t){e[t.row][t.col]=t.value})),e},t}();e.SparseMatrix=l,e.transpose=function(t){var e=[],r=[],n=[];t.forEach((function(t,i,a){e.push(i),r.push(a),n.push(t)}));var i=[t.nCols,t.nRows];return new l(r,e,n,i)},e.identity=function(t){for(var e=s(t,1)[0],r=new l([],[],[],t),n=0;n<e;n++)r.set(n,n,1);return r},e.pairwiseMultiply=function(t,e){return f(t,e,(function(t,e){return t*e}))},e.add=function(t,e){return f(t,e,(function(t,e){return t+e}))},e.subtract=function(t,e){return f(t,e,(function(t,e){return t-e}))},e.maximum=function(t,e){return f(t,e,(function(t,e){return t>e?t:e}))},e.multiplyScalar=function(t,e){return t.map((function(t){return t*e}))},e.eliminateZeros=function(t){for(var e=new Set,r=t.getValues(),n=t.getRows(),i=t.getCols(),a=0;a<r.length;a++)0===r[a]&&e.add(a);var o=function(t,r){return!e.has(r)},s=r.filter(o),u=n.filter(o),h=i.filter(o);return new l(u,h,s,t.getDims())},e.normalize=function(t,e){var r,n;void 0===e&&(e="l2");var i=c[e],a=new Map;t.forEach((function(t,e,r){var n=a.get(e)||[];n.push(r),a.set(e,n)}));var o=new l([],[],[],t.getDims()),s=function(e){for(var r=a.get(e).sort(),n=r.map((function(r){return t.get(e,r)})),s=i(n),u=0;u<s.length;u++)o.set(e,r[u],s[u])};try{for(var h=u(a.keys()),f=h.next();!f.done;f=h.next())s(f.value)}catch(t){r={error:t}}finally{try{f&&!f.done&&(n=h.return)&&n.call(h)}finally{if(r)throw r.error}}return o};var c=((n={}).max=function(t){for(var e=-1/0,r=0;r<t.length;r++)e=t[r]>e?t[r]:e;return t.map((function(t){return t/e}))},n.l1=function(t){for(var e=0,r=0;r<t.length;r++)e+=t[r];return t.map((function(t){return t/e}))},n.l2=function(t){for(var e=0,r=0;r<t.length;r++)e+=Math.pow(t[r],2);return t.map((function(t){return Math.sqrt(Math.pow(t,2)/e)}))},n);function f(t,e,r){for(var n=new Set,i=[],a=[],o=[],s=function(n,s){i.push(n),a.push(s);var u=r(t.get(n,s),e.get(n,s));o.push(u)},u=t.getValues(),h=t.getRows(),c=t.getCols(),f=0;f<u.length;f++){var p=(g=h[f])+":"+(y=c[f]);n.add(p),s(g,y)}var d=e.getValues(),m=e.getRows(),v=e.getCols();for(f=0;f<d.length;f++){var g,y;p=(g=m[f])+":"+(y=v[f]),n.has(p)||s(g,y)}var b=[t.nRows,t.nCols];return new l(i,a,o,b)}e.getCSR=function(t){var e=[];t.forEach((function(t,r,n){e.push({value:t,row:r,col:n})})),e.sort((function(t,e){return t.row===e.row?t.col-e.col:t.row-e.row}));for(var r=[],n=[],i=[],a=-1,o=0;o<e.length;o++){var s=e[o],u=s.row,h=s.col,l=s.value;u!==a&&(a=u,i.push(o)),r.push(h),n.push(l)}return{indices:r,values:n,indptr:i}}},2286:function(t,e,r){var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.hasOwnProperty.call(t,r)&&n(e,t,r);return i(e,t),e},o=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.initializeSearch=e.makeInitializedNNSearch=e.makeInitializations=e.makeNNDescent=void 0;var s=a(r(1853)),u=a(r(702)),h=a(r(3731)),l=a(r(8186));e.makeNNDescent=function(t,e){return function(r,n,i,a,o,u,h,c){void 0===a&&(a=10),void 0===o&&(o=50),void 0===u&&(u=.001),void 0===h&&(h=.5),void 0===c&&(c=!0);for(var f=r.length,p=s.makeHeap(r.length,i),d=0;d<r.length;d++)for(var m=s.rejectionSample(i,r.length,e),v=0;v<m.length;v++){var g=t(r[d],r[m[v]]);s.heapPush(p,d,g,m[v],1),s.heapPush(p,m[v],g,d,1)}if(c)for(var y=0;y<n.length;y++)for(d=0;d<n[y].length&&!(n[y][d]<0);d++)for(v=d+1;v<n[y].length&&!(n[y][v]<0);v++)g=t(r[n[y][d]],r[n[y][v]]),s.heapPush(p,n[y][d],g,n[y][v],1),s.heapPush(p,n[y][v],g,n[y][d],1);for(y=0;y<a;y++){var b=s.buildCandidates(p,f,i,o,e),w=0;for(d=0;d<f;d++)for(v=0;v<o;v++){var S=Math.floor(b[0][d][v]);if(!(S<0||l.tauRand(e)<h))for(var M=0;M<o;M++){var z=Math.floor(b[0][d][M]),_=b[2][d][v],N=b[2][d][M];z<0||!_&&!N||(g=t(r[S],r[z]),w+=s.heapPush(p,S,g,z,1),w+=s.heapPush(p,z,g,S,1))}}if(w<=u*i*r.length)break}return s.deheapSort(p)}},e.makeInitializations=function(t){return{initFromRandom:function(e,r,n,i,a){for(var o=0;o<n.length;o++)for(var u=l.rejectionSample(e,r.length,a),h=0;h<u.length;h++)if(!(u[h]<0)){var c=t(r[u[h]],n[o]);s.heapPush(i,o,c,u[h],1)}},initFromTree:function(e,r,n,i,a){for(var o=0;o<n.length;o++)for(var u=h.searchFlatTree(n[o],e,a),l=0;l<u.length;l++){if(u[l]<0)return;var c=t(r[u[l]],n[o]);s.heapPush(i,o,c,u[l],1)}}}},e.makeInitializedNNSearch=function(t){return function(e,r,n,i){for(var a,h,l=u.getCSR(r),c=l.indices,f=l.indptr,p=0;p<i.length;p++)for(var d=new Set(n[0][p]);;){var m=s.smallestFlagged(n,p);if(-1===m)break;var v=c.slice(f[m],f[m+1]);try{for(var g=(a=void 0,o(v)),y=g.next();!y.done;y=g.next()){var b=y.value;if(b!==m&&-1!==b&&!d.has(b)){var w=t(e[b],i[p]);s.uncheckedHeapPush(n,p,w,b,1),d.add(b)}}}catch(t){a={error:t}}finally{try{y&&!y.done&&(h=g.return)&&h.call(g)}finally{if(a)throw a.error}}}return n}},e.initializeSearch=function(t,e,r,n,i,a,u){var h,l,c=s.makeHeap(r.length,n);if(i(n,e,r,c,u),t)try{for(var f=o(t),p=f.next();!p.done;p=f.next())a(p.value,e,r,c,u)}catch(t){h={error:t}}finally{try{p&&!p.done&&(l=f.return)&&l.call(f)}finally{if(h)throw h.error}}return c}},3731:function(t,e,r){var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.hasOwnProperty.call(t,r)&&n(e,t,r);return i(e,t),e},o=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,i,a=r.call(t),o=[];try{for(;(void 0===e||e-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o},s=this&&this.__spread||function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(o(arguments[e]));return t},u=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.searchFlatTree=e.makeLeafArray=e.makeForest=e.FlatTree=void 0;var h=a(r(8186)),l=function(t,e,r,n){this.hyperplanes=t,this.offsets=e,this.children=r,this.indices=n};function c(t,e,r,n,i){if(void 0===r&&(r=30),e.length>r){var a=function(t,e,r){var n=t[0].length,i=h.tauRandInt(e.length,r),a=h.tauRandInt(e.length,r);a=(a+=i===a?1:0)%e.length;for(var o=e[i],s=e[a],u=0,l=h.zeros(n),c=0;c<l.length;c++)l[c]=t[o][c]-t[s][c],u-=l[c]*(t[o][c]+t[s][c])/2;var f=0,p=0,d=h.zeros(e.length);for(c=0;c<e.length;c++){for(var m=u,v=0;v<n;v++)m+=l[v]*t[e[c]][v];0===m?(d[c]=h.tauRandInt(2,r),0===d[c]?f+=1:p+=1):m>0?(d[c]=0,f+=1):(d[c]=1,p+=1)}var g=h.zeros(f),y=h.zeros(p);for(f=0,p=0,c=0;c<d.length;c++)0===d[c]?(g[f]=e[c],f+=1):(y[p]=e[c],p+=1);return{indicesLeft:g,indicesRight:y,hyperplane:l,offset:u}}(t,e,i),o=a.indicesLeft,s=a.indicesRight,u=a.hyperplane,l=a.offset;return{leftChild:c(t,o,r,n+1,i),rightChild:c(t,s,r,n+1,i),isLeaf:!1,hyperplane:u,offset:l}}return{indices:e,isLeaf:!0}}function f(t,e,r,n,i,a,o){var u;if(t.isLeaf)return n[a][0]=-o,(u=i[o]).splice.apply(u,s([0,t.indices.length],t.indices)),{nodeNum:a,leafNum:o+=1};e[a]=t.hyperplane,r[a]=t.offset,n[a][0]=a+1;var h=a,l=f(t.leftChild,e,r,n,i,a+1,o);return a=l.nodeNum,o=l.leafNum,n[h][1]=a+1,{nodeNum:(l=f(t.rightChild,e,r,n,i,a+1,o)).nodeNum,leafNum:l.leafNum}}function p(t){return t.isLeaf?1:1+p(t.leftChild)+p(t.rightChild)}function d(t){return t.isLeaf?1:d(t.leftChild)+d(t.rightChild)}function m(t,e,r,n){for(var i=e,a=0;a<r.length;a++)i+=t[a]*r[a];return 0===i?h.tauRandInt(2,n):i>0?0:1}e.FlatTree=l,e.makeForest=function(t,e,r,n){var i=Math.max(10,e);return h.range(r).map((function(e,r){return function(t,e,r,n){return void 0===e&&(e=30),c(t,h.range(t.length),e,r,n)}(t,i,r,n)})).map((function(t){return function(t,e){var r=p(t),n=d(t),i=h.range(r).map((function(){return h.zeros(t.hyperplane?t.hyperplane.length:0)})),a=h.zeros(r),o=h.range(r).map((function(){return[-1,-1]})),s=h.range(n).map((function(){return h.range(e).map((function(){return-1}))}));return f(t,i,a,o,s,0,0),new l(i,a,o,s)}(t,i)}))},e.makeLeafArray=function(t){var e,r;if(t.length>0){var n=[];try{for(var i=u(t),a=i.next();!a.done;a=i.next()){var o=a.value;n.push.apply(n,s(o.indices))}}catch(t){e={error:t}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}return n}return[[-1]]},e.searchFlatTree=function(t,e,r){for(var n=0;e.children[n][0]>0;)n=0===m(e.hyperplanes[n],e.offsets[n],t,r)?e.children[n][0]:e.children[n][1];var i=-1*e.children[n][0];return e.indices[i]}},5112:function(t,e,r){var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.hasOwnProperty.call(t,r)&&n(e,t,r);return i(e,t),e},o=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,a){function o(t){try{u(n.next(t))}catch(t){a(t)}}function s(t){try{u(n.throw(t))}catch(t){a(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(o,s)}u((n=n.apply(t,e||[])).next())}))},s=this&&this.__generator||function(t,e){var r,n,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;o;)try{if(r=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,n=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(6===a[0]&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=e.call(t,o)}catch(t){a=[6,t],n=0}finally{r=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}},u=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,i,a=r.call(t),o=[];try{for(;(void 0===e||e-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o},h=this&&this.__spread||function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(u(arguments[e]));return t},l=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.initTransform=e.resetLocalConnectivity=e.fastIntersection=e.findABParams=e.cosine=e.euclidean=e.UMAP=void 0;var c=a(r(1853)),f=a(r(702)),p=a(r(2286)),d=a(r(3731)),m=a(r(8186)),v=l(r(5407)),g=1e-5,y=.001,b=function(){function t(t){var e=this;void 0===t&&(t={}),this.learningRate=1,this.localConnectivity=1,this.minDist=.1,this.nComponents=2,this.nEpochs=0,this.nNeighbors=15,this.negativeSampleRate=5,this.random=Math.random,this.repulsionStrength=1,this.setOpMixRatio=1,this.spread=1,this.transformQueueSize=4,this.targetMetric="categorical",this.targetWeight=.5,this.targetNNeighbors=this.nNeighbors,this.distanceFn=w,this.isInitialized=!1,this.rpForest=[],this.embedding=[],this.optimizationState=new S;var r=function(r){void 0!==t[r]&&(e[r]=t[r])};r("distanceFn"),r("learningRate"),r("localConnectivity"),r("minDist"),r("nComponents"),r("nEpochs"),r("nNeighbors"),r("negativeSampleRate"),r("random"),r("repulsionStrength"),r("setOpMixRatio"),r("spread"),r("transformQueueSize")}return t.prototype.fit=function(t){return this.initializeFit(t),this.optimizeLayout(),this.embedding},t.prototype.fitAsync=function(t,e){return void 0===e&&(e=function(){return!0}),o(this,void 0,void 0,(function(){return s(this,(function(r){switch(r.label){case 0:return this.initializeFit(t),[4,this.optimizeLayoutAsync(e)];case 1:return r.sent(),[2,this.embedding]}}))}))},t.prototype.setSupervisedProjection=function(t,e){void 0===e&&(e={}),this.Y=t,this.targetMetric=e.targetMetric||this.targetMetric,this.targetWeight=e.targetWeight||this.targetWeight,this.targetNNeighbors=e.targetNNeighbors||this.targetNNeighbors},t.prototype.setPrecomputedKNN=function(t,e){this.knnIndices=t,this.knnDistances=e},t.prototype.initializeFit=function(t){if(t.length<=this.nNeighbors)throw new Error("Not enough data points ("+t.length+") to create nNeighbors: "+this.nNeighbors+". Add more data points or adjust the configuration.");if(this.X===t&&this.isInitialized)return this.getNEpochs();if(this.X=t,!this.knnIndices&&!this.knnDistances){var e=this.nearestNeighbors(t);this.knnIndices=e.knnIndices,this.knnDistances=e.knnDistances}this.graph=this.fuzzySimplicialSet(t,this.nNeighbors,this.setOpMixRatio),this.makeSearchFns(),this.searchGraph=this.makeSearchGraph(t),this.processGraphForSupervisedProjection();var r=this.initializeSimplicialSetEmbedding(),n=r.head,i=r.tail,a=r.epochsPerSample;return this.optimizationState.head=n,this.optimizationState.tail=i,this.optimizationState.epochsPerSample=a,this.initializeOptimization(),this.prepareForOptimizationLoop(),this.isInitialized=!0,this.getNEpochs()},t.prototype.makeSearchFns=function(){var t=p.makeInitializations(this.distanceFn),e=t.initFromTree,r=t.initFromRandom;this.initFromTree=e,this.initFromRandom=r,this.search=p.makeInitializedNNSearch(this.distanceFn)},t.prototype.makeSearchGraph=function(t){for(var e=this.knnIndices,r=this.knnDistances,n=[t.length,t.length],i=new f.SparseMatrix([],[],[],n),a=0;a<e.length;a++)for(var o=e[a],s=r[a],u=0;u<o.length;u++){var h=o[u],l=s[u];l>0&&i.set(a,h,l)}var c=f.transpose(i);return f.maximum(i,c)},t.prototype.transform=function(t){var e=this,r=this.X;if(void 0===r||0===r.length)throw new Error("No data has been fit.");var n=Math.floor(this.nNeighbors*this.transformQueueSize);n=Math.min(r.length,n);var i=p.initializeSearch(this.rpForest,r,t,n,this.initFromRandom,this.initFromTree,this.random),a=this.search(r,this.searchGraph,i,t),o=c.deheapSort(a),s=o.indices,u=o.weights;s=s.map((function(t){return t.slice(0,e.nNeighbors)})),u=u.map((function(t){return t.slice(0,e.nNeighbors)}));var h=Math.max(0,this.localConnectivity-1),l=this.smoothKNNDistance(u,this.nNeighbors,h),d=l.sigmas,v=l.rhos,g=this.computeMembershipStrengths(s,u,d,v),y=g.rows,b=g.cols,w=g.vals,S=[t.length,r.length],M=new f.SparseMatrix(y,b,w,S),z=f.normalize(M,"l1"),_=f.getCSR(z),N=t.length,E=x(m.reshape2d(_.indices,N,this.nNeighbors),m.reshape2d(_.values,N,this.nNeighbors),this.embedding),k=this.nEpochs?this.nEpochs/3:M.nRows<=1e4?100:30,P=M.getValues().reduce((function(t,e){return e>t?e:t}),0);M=M.map((function(t){return t<P/k?0:t})),M=f.eliminateZeros(M);var O=this.makeEpochsPerSample(M.getValues(),k),R=M.getRows(),j=M.getCols();return this.assignOptimizationStateParameters({headEmbedding:E,tailEmbedding:this.embedding,head:R,tail:j,currentEpoch:0,nEpochs:k,nVertices:M.getDims()[1],epochsPerSample:O}),this.prepareForOptimizationLoop(),this.optimizeLayout()},t.prototype.processGraphForSupervisedProjection=function(){var t=this.Y,e=this.X;if(t){if(t.length!==e.length)throw new Error("Length of X and y must be equal");if("categorical"===this.targetMetric){var r=this.targetWeight<1?1/(1-this.targetWeight)*2.5:1e12;this.graph=this.categoricalSimplicialSetIntersection(this.graph,t,r)}}},t.prototype.step=function(){var t=this.optimizationState.currentEpoch;return t<this.getNEpochs()&&this.optimizeLayoutStep(t),this.optimizationState.currentEpoch},t.prototype.getEmbedding=function(){return this.embedding},t.prototype.nearestNeighbors=function(t){var e,r=this.distanceFn,n=this.nNeighbors,i=p.makeNNDescent(r,this.random),a=5+Math.floor(.5==(e=Math.pow(t.length,.5)/20)?0:Math.round(e)),o=Math.max(5,Math.floor(Math.round(function(t){return Math.log(t)/Math.log(2)}(t.length))));this.rpForest=d.makeForest(t,n,a,this.random);var s=i(t,d.makeLeafArray(this.rpForest),n,o);return{knnIndices:s.indices,knnDistances:s.weights}},t.prototype.fuzzySimplicialSet=function(t,e,r){void 0===r&&(r=1);var n=this,i=n.knnIndices,a=void 0===i?[]:i,o=n.knnDistances,s=void 0===o?[]:o,u=n.localConnectivity,h=this.smoothKNNDistance(s,e,u),l=h.sigmas,c=h.rhos,p=this.computeMembershipStrengths(a,s,l,c),d=p.rows,m=p.cols,v=p.vals,g=[t.length,t.length],y=new f.SparseMatrix(d,m,v,g),b=f.transpose(y),w=f.pairwiseMultiply(y,b),S=f.subtract(f.add(y,b),w),M=f.multiplyScalar(S,r),z=f.multiplyScalar(w,1-r);return f.add(M,z)},t.prototype.categoricalSimplicialSetIntersection=function(t,e,r,n){void 0===n&&(n=1);var i=N(t,e,n,r);return E(i=f.eliminateZeros(i))},t.prototype.smoothKNNDistance=function(t,e,r,n,i){void 0===r&&(r=1),void 0===n&&(n=64),void 0===i&&(i=1);for(var a=Math.log(e)/Math.log(2)*i,o=m.zeros(t.length),s=m.zeros(t.length),u=0;u<t.length;u++){var h=0,l=1/0,c=1,f=t[u],p=f.filter((function(t){return t>0}));if(p.length>=r){var d=Math.floor(r),v=r-d;d>0?(o[u]=p[d-1],v>g&&(o[u]+=v*(p[d]-p[d-1]))):o[u]=v*p[0]}else p.length>0&&(o[u]=m.max(p));for(var b=0;b<n;b++){for(var w=0,S=1;S<t[u].length;S++){var M=t[u][S]-o[u];w+=M>0?Math.exp(-M/c):1}if(Math.abs(w-a)<g)break;w>a?c=(h+(l=c))/2:(h=c,l===1/0?c*=2:c=(h+l)/2)}if(s[u]=c,o[u]>0){var z=m.mean(f);s[u]<y*z&&(s[u]=y*z)}else{var _=m.mean(t.map(m.mean));s[u]<y*_&&(s[u]=y*_)}}return{sigmas:s,rhos:o}},t.prototype.computeMembershipStrengths=function(t,e,r,n){for(var i=t.length,a=t[0].length,o=m.zeros(i*a),s=m.zeros(i*a),u=m.zeros(i*a),h=0;h<i;h++)for(var l=0;l<a;l++){var c=0;-1!==t[h][l]&&(c=t[h][l]===h?0:e[h][l]-n[h]<=0?1:Math.exp(-(e[h][l]-n[h])/r[h]),o[h*a+l]=h,s[h*a+l]=t[h][l],u[h*a+l]=c)}return{rows:o,cols:s,vals:u}},t.prototype.initializeSimplicialSetEmbedding=function(){for(var t=this,e=this.getNEpochs(),r=this.nComponents,n=this.graph.getValues(),i=0,a=0;a<n.length;a++){var o=n[a];i<n[a]&&(i=o)}var s=this.graph.map((function(t){return t<i/e?0:t}));this.embedding=m.zeros(s.nRows).map((function(){return m.zeros(r).map((function(){return 20*m.tauRand(t.random)-10}))}));var u=[],h=[],l=[],c=s.getAll();for(a=0;a<c.length;a++){var f=c[a];f.value&&(u.push(f.value),l.push(f.row),h.push(f.col))}return{head:h,tail:l,epochsPerSample:this.makeEpochsPerSample(u,e)}},t.prototype.makeEpochsPerSample=function(t,e){var r=m.filled(t.length,-1),n=m.max(t),i=t.map((function(t){return t/n*e}));return i.forEach((function(t,n){t>0&&(r[n]=e/i[n])})),r},t.prototype.assignOptimizationStateParameters=function(t){Object.assign(this.optimizationState,t)},t.prototype.prepareForOptimizationLoop=function(){var t=this,e=t.repulsionStrength,r=t.learningRate,n=t.negativeSampleRate,i=this.optimizationState,a=i.epochsPerSample,o=i.headEmbedding,s=i.tailEmbedding,u=o[0].length,l=o.length===s.length,c=a.map((function(t){return t/n})),f=h(c),p=h(a);this.assignOptimizationStateParameters({epochOfNextSample:p,epochOfNextNegativeSample:f,epochsPerNegativeSample:c,moveOther:l,initialAlpha:r,alpha:r,gamma:e,dim:u})},t.prototype.initializeOptimization=function(){var t=this.embedding,e=this.embedding,r=this.optimizationState,n=r.head,i=r.tail,a=r.epochsPerSample,o=this.getNEpochs(),s=this.graph.nCols,u=_(this.spread,this.minDist),h=u.a,l=u.b;this.assignOptimizationStateParameters({headEmbedding:t,tailEmbedding:e,head:n,tail:i,epochsPerSample:a,a:h,b:l,nEpochs:o,nVertices:s})},t.prototype.optimizeLayoutStep=function(t){for(var e=this.optimizationState,r=e.head,n=e.tail,i=e.headEmbedding,a=e.tailEmbedding,o=e.epochsPerSample,s=e.epochOfNextSample,u=e.epochOfNextNegativeSample,h=e.epochsPerNegativeSample,l=e.moveOther,c=e.initialAlpha,f=e.alpha,p=e.gamma,d=e.a,v=e.b,g=e.dim,y=e.nEpochs,b=e.nVertices,w=0;w<o.length;w++)if(!(s[w]>t)){var S=r[w],_=n[w],N=i[S],E=a[_],x=z(N,E),k=0;x>0&&(k=-2*d*v*Math.pow(x,v-1),k/=d*Math.pow(x,v)+1);for(var P=0;P<g;P++){var O=M(k*(N[P]-E[P]),4);N[P]+=O*f,l&&(E[P]+=-O*f)}s[w]+=o[w];for(var R=Math.floor((t-u[w])/h[w]),j=0;j<R;j++){var C=m.tauRandInt(b,this.random),F=a[C],A=z(N,F),D=0;if(A>0)D=2*p*v,D/=(.001+A)*(d*Math.pow(A,v)+1);else if(S===C)continue;for(P=0;P<g;P++)O=4,D>0&&(O=M(D*(N[P]-F[P]),4)),N[P]+=O*f}u[w]+=R*h[w]}return e.alpha=c*(1-t/y),e.currentEpoch+=1,i},t.prototype.optimizeLayoutAsync=function(t){var e=this;return void 0===t&&(t=function(){return!0}),new Promise((function(r,n){var i=function(){return o(e,void 0,void 0,(function(){var e,a,o,u,h,l;return s(this,(function(s){try{if(e=this.optimizationState,a=e.nEpochs,o=e.currentEpoch,this.embedding=this.optimizeLayoutStep(o),u=this.optimizationState.currentEpoch,h=!1===t(u),l=u===a,h||l)return[2,r(l)];setTimeout((function(){return i()}),0)}catch(t){n(t)}return[2]}))}))};setTimeout((function(){return i()}),0)}))},t.prototype.optimizeLayout=function(t){void 0===t&&(t=function(){return!0});for(var e=!1,r=[];!e;){var n=this.optimizationState,i=n.nEpochs,a=n.currentEpoch;r=this.optimizeLayoutStep(a);var o=this.optimizationState.currentEpoch,s=!1===t(o);e=o===i||s}return r},t.prototype.getNEpochs=function(){var t=this.graph;if(this.nEpochs>0)return this.nEpochs;var e=t.nRows;return e<=2500?500:e<=5e3?400:e<=7500?300:200},t}();function w(t,e){for(var r=0,n=0;n<t.length;n++)r+=Math.pow(t[n]-e[n],2);return Math.sqrt(r)}e.UMAP=b,e.euclidean=w,e.cosine=function(t,e){for(var r=0,n=0,i=0,a=0;a<t.length;a++)r+=t[a]*e[a],n+=Math.pow(t[a],2),i+=Math.pow(e[a],2);return 0===n&&0===i?0:0===n||0===i?1:1-r/Math.sqrt(n*i)};var S=function(){this.currentEpoch=0,this.headEmbedding=[],this.tailEmbedding=[],this.head=[],this.tail=[],this.epochsPerSample=[],this.epochOfNextSample=[],this.epochOfNextNegativeSample=[],this.epochsPerNegativeSample=[],this.moveOther=!0,this.initialAlpha=1,this.alpha=1,this.gamma=1,this.a=1.5769434603113077,this.b=.8950608779109733,this.dim=2,this.nEpochs=500,this.nVertices=0};function M(t,e){return t>e?e:t<-e?-e:t}function z(t,e){for(var r=0,n=0;n<t.length;n++)r+=Math.pow(t[n]-e[n],2);return r}function _(t,e){var r=m.linear(0,3*t,300).map((function(t){return t<e?1:t})),n=m.zeros(r.length).map((function(n,i){return r[i]>=e?Math.exp(-(r[i]-e)/t):n})),i={x:r,y:n},a=v.default(i,(function(t){var e=u(t,2),r=e[0],n=e[1];return function(t){return 1/(1+r*Math.pow(t,2*n))}}),{damping:1.5,initialValues:[.5,.5],gradientDifference:.1,maxIterations:100,errorTolerance:.01}).parameterValues,o=u(a,2);return{a:o[0],b:o[1]}}function N(t,e,r,n){return void 0===r&&(r=1),void 0===n&&(n=5),t.map((function(t,i,a){return-1===e[i]||-1===e[a]?t*Math.exp(-r):e[i]!==e[a]?t*Math.exp(-n):t}))}function E(t){t=f.normalize(t,"max");var e=f.transpose(t),r=f.pairwiseMultiply(e,t);return t=f.add(t,f.subtract(e,r)),f.eliminateZeros(t)}function x(t,e,r){for(var n=m.zeros(t.length).map((function(t){return m.zeros(r[0].length)})),i=0;i<t.length;i++)for(var a=0;a<t[0].length;a++)for(var o=0;o<r[0].length;o++){var s=t[i][a];n[i][o]+=e[i][a]*r[s][o]}return n}e.findABParams=_,e.fastIntersection=N,e.resetLocalConnectivity=E,e.initTransform=x},8186:function(t,e){var r=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};function n(t,e){return Math.floor(e()*t)}function i(t){for(var e=[],r=0;r<t;r++)e.push(void 0);return e}function a(t,e){return i(t).map((function(){return e}))}function o(t){return a(t,0)}function s(t){return t.reduce((function(t,e){return t+e}))}Object.defineProperty(e,"__esModule",{value:!0}),e.reshape2d=e.rejectionSample=e.max2d=e.max=e.mean=e.sum=e.linear=e.ones=e.zeros=e.filled=e.range=e.empty=e.norm=e.tauRand=e.tauRandInt=void 0,e.tauRandInt=n,e.tauRand=function(t){return t()},e.norm=function(t){var e,n,i=0;try{for(var a=r(t),o=a.next();!o.done;o=a.next()){var s=o.value;i+=Math.pow(s,2)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(n=a.return)&&n.call(a)}finally{if(e)throw e.error}}return Math.sqrt(i)},e.empty=i,e.range=function(t){return i(t).map((function(t,e){return e}))},e.filled=a,e.zeros=o,e.ones=function(t){return a(t,1)},e.linear=function(t,e,r){return i(r).map((function(n,i){return t+i*((e-t)/(r-1))}))},e.sum=s,e.mean=function(t){return s(t)/t.length},e.max=function(t){for(var e=0,r=0;r<t.length;r++)e=t[r]>e?t[r]:e;return e},e.max2d=function(t){for(var e=0,r=0;r<t.length;r++)for(var n=0;n<t[r].length;n++)e=t[r][n]>e?t[r][n]:e;return e},e.rejectionSample=function(t,e,r){for(var i=o(t),a=0;a<t;a++)for(var s=!0;s;){for(var u=n(e,r),h=!1,l=0;l<a;l++)if(u===i[l]){h=!0;break}h||(s=!1),i[a]=u}return i},e.reshape2d=function(t,e,r){var n=[],i=0;if(t.length!==e*r)throw new Error("Array dimensions must match input length.");for(var a=0;a<e;a++){for(var o=[],s=0;s<r;s++)o.push(t[i]),i+=1;n.push(o)}return n}},5407:(t,e,r)=>{r.r(e),r.d(e,{default:()=>u});const n=Object.prototype.toString;function i(t){return n.call(t).endsWith("Array]")}function a(t,e,r){let n=0;const i=r(e);for(let e=0;e<t.x.length;e++)n+=Math.abs(t.y[e]-i(t.x[e]));return n}var o=r(5907);function s(t,e,r,n,i){let a=r*n*n,s=o.uq.eye(e.length,e.length,a);const u=i(e);let h=new Float64Array(t.x.length);for(let e=0;e<t.x.length;e++)h[e]=u(t.x[e]);let l=function(t,e,r,n,i){const a=r.length,s=t.x.length;let u=new Array(a);for(let o=0;o<a;o++){u[o]=new Array(s);let a=r.slice();a[o]+=n;let h=i(a);for(let r=0;r<s;r++)u[o][r]=e[r]-h(t.x[r])}return new o.uq(u)}(t,h,e,n,i),c=function(t,e){const r=t.x.length;let n=new Array(r);for(let i=0;i<r;i++)n[i]=[t.y[i]-e[i]];return new o.uq(n)}(t,h),f=(0,o.DI)(s.add(l.mmul(l.transpose())));return(e=(e=new o.uq([e])).sub(f.mmul(l).mmul(c).mul(n).transpose())).to1DArray()}function u(t,e,r={}){let{maxIterations:n=100,gradientDifference:o=.1,damping:u=0,errorTolerance:h=.01,minValues:l,maxValues:c,initialValues:f}=r;if(u<=0)throw new Error("The damping option must be a positive number");if(!t.x||!t.y)throw new Error("The data parameter must have x and y elements");if(!i(t.x)||t.x.length<2||!i(t.y)||t.y.length<2)throw new Error("The data parameter elements must be an array with more than 2 points");if(t.x.length!==t.y.length)throw new Error("The data parameter elements must have the same size");let p=f||new Array(e.length).fill(1),d=p.length;if(c=c||new Array(d).fill(Number.MAX_SAFE_INTEGER),l=l||new Array(d).fill(Number.MIN_SAFE_INTEGER),c.length!==l.length)throw new Error("minValues and maxValues must be the same size");if(!i(p))throw new Error("initialValues must be an array");let m,v=a(t,p,e),g=v<=h;for(m=0;m<n&&!g;m++){p=s(t,p,u,o,e);for(let t=0;t<d;t++)p[t]=Math.min(Math.max(l[t],p[t]),c[t]);if(v=a(t,p,e),isNaN(v))break;g=v<=h}return{parameterValues:p,parameterError:v,iterations:m}}}}]);
|
|
1
|
+
"use strict";(self.webpackChunkeda=self.webpackChunkeda||[]).push([[415],{702:function(t,e,r){var n,i=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),a=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.hasOwnProperty.call(t,r)&&i(e,t,r);return a(e,t),e},s=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,i,a=r.call(t),o=[];try{for(;(void 0===e||e-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o},u=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.getCSR=e.normalize=e.eliminateZeros=e.multiplyScalar=e.maximum=e.subtract=e.add=e.pairwiseMultiply=e.identity=e.transpose=e.SparseMatrix=void 0;var h=o(r(8186)),l=function(){function t(t,e,r,n){if(this.entries=new Map,this.nRows=0,this.nCols=0,t.length!==e.length||t.length!==r.length)throw new Error("rows, cols and values arrays must all have the same length");this.nRows=n[0],this.nCols=n[1];for(var i=0;i<r.length;i++){var a=t[i],o=e[i];this.checkDims(a,o);var s=this.makeKey(a,o);this.entries.set(s,{value:r[i],row:a,col:o})}}return t.prototype.makeKey=function(t,e){return t+":"+e},t.prototype.checkDims=function(t,e){if(!(t<this.nRows&&e<this.nCols))throw new Error("row and/or col specified outside of matrix dimensions")},t.prototype.set=function(t,e,r){this.checkDims(t,e);var n=this.makeKey(t,e);this.entries.has(n)?this.entries.get(n).value=r:this.entries.set(n,{value:r,row:t,col:e})},t.prototype.get=function(t,e,r){void 0===r&&(r=0),this.checkDims(t,e);var n=this.makeKey(t,e);return this.entries.has(n)?this.entries.get(n).value:r},t.prototype.getAll=function(t){void 0===t&&(t=!0);var e=[];return this.entries.forEach((function(t){e.push(t)})),t&&e.sort((function(t,e){return t.row===e.row?t.col-e.col:t.row-e.row})),e},t.prototype.getDims=function(){return[this.nRows,this.nCols]},t.prototype.getRows=function(){return Array.from(this.entries,(function(t){var e=s(t,2);return e[0],e[1].row}))},t.prototype.getCols=function(){return Array.from(this.entries,(function(t){var e=s(t,2);return e[0],e[1].col}))},t.prototype.getValues=function(){return Array.from(this.entries,(function(t){var e=s(t,2);return e[0],e[1].value}))},t.prototype.forEach=function(t){this.entries.forEach((function(e){return t(e.value,e.row,e.col)}))},t.prototype.map=function(e){var r=[];this.entries.forEach((function(t){r.push(e(t.value,t.row,t.col))}));var n=[this.nRows,this.nCols];return new t(this.getRows(),this.getCols(),r,n)},t.prototype.toArray=function(){var t=this,e=h.empty(this.nRows).map((function(){return h.zeros(t.nCols)}));return this.entries.forEach((function(t){e[t.row][t.col]=t.value})),e},t}();e.SparseMatrix=l,e.transpose=function(t){var e=[],r=[],n=[];t.forEach((function(t,i,a){e.push(i),r.push(a),n.push(t)}));var i=[t.nCols,t.nRows];return new l(r,e,n,i)},e.identity=function(t){for(var e=s(t,1)[0],r=new l([],[],[],t),n=0;n<e;n++)r.set(n,n,1);return r},e.pairwiseMultiply=function(t,e){return f(t,e,(function(t,e){return t*e}))},e.add=function(t,e){return f(t,e,(function(t,e){return t+e}))},e.subtract=function(t,e){return f(t,e,(function(t,e){return t-e}))},e.maximum=function(t,e){return f(t,e,(function(t,e){return t>e?t:e}))},e.multiplyScalar=function(t,e){return t.map((function(t){return t*e}))},e.eliminateZeros=function(t){for(var e=new Set,r=t.getValues(),n=t.getRows(),i=t.getCols(),a=0;a<r.length;a++)0===r[a]&&e.add(a);var o=function(t,r){return!e.has(r)},s=r.filter(o),u=n.filter(o),h=i.filter(o);return new l(u,h,s,t.getDims())},e.normalize=function(t,e){var r,n;void 0===e&&(e="l2");var i=c[e],a=new Map;t.forEach((function(t,e,r){var n=a.get(e)||[];n.push(r),a.set(e,n)}));var o=new l([],[],[],t.getDims()),s=function(e){for(var r=a.get(e).sort(),n=r.map((function(r){return t.get(e,r)})),s=i(n),u=0;u<s.length;u++)o.set(e,r[u],s[u])};try{for(var h=u(a.keys()),f=h.next();!f.done;f=h.next())s(f.value)}catch(t){r={error:t}}finally{try{f&&!f.done&&(n=h.return)&&n.call(h)}finally{if(r)throw r.error}}return o};var c=((n={}).max=function(t){for(var e=-1/0,r=0;r<t.length;r++)e=t[r]>e?t[r]:e;return t.map((function(t){return t/e}))},n.l1=function(t){for(var e=0,r=0;r<t.length;r++)e+=t[r];return t.map((function(t){return t/e}))},n.l2=function(t){for(var e=0,r=0;r<t.length;r++)e+=Math.pow(t[r],2);return t.map((function(t){return Math.sqrt(Math.pow(t,2)/e)}))},n);function f(t,e,r){for(var n=new Set,i=[],a=[],o=[],s=function(n,s){i.push(n),a.push(s);var u=r(t.get(n,s),e.get(n,s));o.push(u)},u=t.getValues(),h=t.getRows(),c=t.getCols(),f=0;f<u.length;f++){var p=(g=h[f])+":"+(y=c[f]);n.add(p),s(g,y)}var d=e.getValues(),m=e.getRows(),v=e.getCols();for(f=0;f<d.length;f++){var g,y;p=(g=m[f])+":"+(y=v[f]),n.has(p)||s(g,y)}var b=[t.nRows,t.nCols];return new l(i,a,o,b)}e.getCSR=function(t){var e=[];t.forEach((function(t,r,n){e.push({value:t,row:r,col:n})})),e.sort((function(t,e){return t.row===e.row?t.col-e.col:t.row-e.row}));for(var r=[],n=[],i=[],a=-1,o=0;o<e.length;o++){var s=e[o],u=s.row,h=s.col,l=s.value;u!==a&&(a=u,i.push(o)),r.push(h),n.push(l)}return{indices:r,values:n,indptr:i}}},1853:function(t,e,r){var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.hasOwnProperty.call(t,r)&&n(e,t,r);return i(e,t),e};Object.defineProperty(e,"__esModule",{value:!0}),e.smallestFlagged=e.deheapSort=e.buildCandidates=e.uncheckedHeapPush=e.heapPush=e.rejectionSample=e.makeHeap=void 0;var o=a(r(8186));function s(t,e){var r=function(r){return o.empty(t).map((function(){return o.filled(e,r)}))},n=[];return n.push(r(-1)),n.push(r(1/0)),n.push(r(0)),n}function u(t,e,r,n,i){e=Math.floor(e);var a=t[0][e],o=t[1][e];if(t[2][e],r>=o[0])return 0;for(var s=0;s<a.length;s++)if(n===a[s])return 0;return h(t,e,r,n,i)}function h(t,e,r,n,i){var a=t[0][e],o=t[1][e],s=t[2][e];if(r>=o[0])return 0;o[0]=r,a[0]=n,s[0]=i;for(var u=0,h=0;;){var l=2*u+1,c=l+1,f=t[0][0].length;if(l>=f)break;if(c>=f){if(!(o[l]>r))break;h=l}else if(o[l]>=o[c]){if(!(r<o[l]))break;h=l}else{if(!(r<o[c]))break;h=c}o[u]=o[h],a[u]=a[h],s[u]=s[h],u=h}return o[u]=r,a[u]=n,s[u]=i,1}function l(t,e,r,n){for(;2*n+1<r;){var i=2*n+1,a=i+1,o=n;if(t[o]<t[i]&&(o=i),a<r&&t[o]<t[a]&&(o=a),o===n)break;var s=t[n];t[n]=t[o],t[o]=s;var u=e[n];e[n]=e[o],e[o]=u,n=o}}e.makeHeap=s,e.rejectionSample=function(t,e,r){for(var n=o.zeros(t),i=0;i<t;i++){for(var a=!0,s=0;a;){s=o.tauRandInt(e,r);for(var u=!1,h=0;h<i;h++)if(s===n[h]){u=!0;break}u||(a=!1)}n[i]=s}return n},e.heapPush=u,e.uncheckedHeapPush=h,e.buildCandidates=function(t,e,r,n,i){for(var a=s(e,n),h=0;h<e;h++)for(var l=0;l<r;l++)if(!(t[0][h][l]<0)){var c=t[0][h][l],f=t[2][h][l],p=o.tauRand(i);u(a,h,p,c,f),u(a,c,p,h,f),t[2][h][l]=0}return a},e.deheapSort=function(t){for(var e=t[0],r=t[1],n=0;n<e.length;n++)for(var i=e[n],a=r[n],o=0;o<i.length-1;o++){var s=i.length-o-1,u=a.length-o-1,h=i[0];i[0]=i[s],i[s]=h;var c=a[0];a[0]=a[u],a[u]=c,l(a,i,u,0)}return{indices:e,weights:r}},e.smallestFlagged=function(t,e){for(var r=t[0][e],n=t[1][e],i=t[2][e],a=1/0,o=-1,s=0;s>r.length;s++)1===i[s]&&n[s]<a&&(a=n[s],o=s);return o>=0?(i[o]=0,Math.floor(r[o])):-1}},2286:function(t,e,r){var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.hasOwnProperty.call(t,r)&&n(e,t,r);return i(e,t),e},o=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.initializeSearch=e.makeInitializedNNSearch=e.makeInitializations=e.makeNNDescent=void 0;var s=a(r(1853)),u=a(r(702)),h=a(r(3731)),l=a(r(8186));e.makeNNDescent=function(t,e){return function(r,n,i,a,o,u,h,c){void 0===a&&(a=10),void 0===o&&(o=50),void 0===u&&(u=.001),void 0===h&&(h=.5),void 0===c&&(c=!0);for(var f=r.length,p=s.makeHeap(r.length,i),d=0;d<r.length;d++)for(var m=s.rejectionSample(i,r.length,e),v=0;v<m.length;v++){var g=t(r[d],r[m[v]]);s.heapPush(p,d,g,m[v],1),s.heapPush(p,m[v],g,d,1)}if(c)for(var y=0;y<n.length;y++)for(d=0;d<n[y].length&&!(n[y][d]<0);d++)for(v=d+1;v<n[y].length&&!(n[y][v]<0);v++)g=t(r[n[y][d]],r[n[y][v]]),s.heapPush(p,n[y][d],g,n[y][v],1),s.heapPush(p,n[y][v],g,n[y][d],1);for(y=0;y<a;y++){var b=s.buildCandidates(p,f,i,o,e),w=0;for(d=0;d<f;d++)for(v=0;v<o;v++){var S=Math.floor(b[0][d][v]);if(!(S<0||l.tauRand(e)<h))for(var M=0;M<o;M++){var z=Math.floor(b[0][d][M]),_=b[2][d][v],N=b[2][d][M];z<0||!_&&!N||(g=t(r[S],r[z]),w+=s.heapPush(p,S,g,z,1),w+=s.heapPush(p,z,g,S,1))}}if(w<=u*i*r.length)break}return s.deheapSort(p)}},e.makeInitializations=function(t){return{initFromRandom:function(e,r,n,i,a){for(var o=0;o<n.length;o++)for(var u=l.rejectionSample(e,r.length,a),h=0;h<u.length;h++)if(!(u[h]<0)){var c=t(r[u[h]],n[o]);s.heapPush(i,o,c,u[h],1)}},initFromTree:function(e,r,n,i,a){for(var o=0;o<n.length;o++)for(var u=h.searchFlatTree(n[o],e,a),l=0;l<u.length;l++){if(u[l]<0)return;var c=t(r[u[l]],n[o]);s.heapPush(i,o,c,u[l],1)}}}},e.makeInitializedNNSearch=function(t){return function(e,r,n,i){for(var a,h,l=u.getCSR(r),c=l.indices,f=l.indptr,p=0;p<i.length;p++)for(var d=new Set(n[0][p]);;){var m=s.smallestFlagged(n,p);if(-1===m)break;var v=c.slice(f[m],f[m+1]);try{for(var g=(a=void 0,o(v)),y=g.next();!y.done;y=g.next()){var b=y.value;if(b!==m&&-1!==b&&!d.has(b)){var w=t(e[b],i[p]);s.uncheckedHeapPush(n,p,w,b,1),d.add(b)}}}catch(t){a={error:t}}finally{try{y&&!y.done&&(h=g.return)&&h.call(g)}finally{if(a)throw a.error}}}return n}},e.initializeSearch=function(t,e,r,n,i,a,u){var h,l,c=s.makeHeap(r.length,n);if(i(n,e,r,c,u),t)try{for(var f=o(t),p=f.next();!p.done;p=f.next())a(p.value,e,r,c,u)}catch(t){h={error:t}}finally{try{p&&!p.done&&(l=f.return)&&l.call(f)}finally{if(h)throw h.error}}return c}},2415:(t,e,r)=>{var n=r(5112);Object.defineProperty(e,"Q",{enumerable:!0,get:function(){return n.UMAP}})},3731:function(t,e,r){var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.hasOwnProperty.call(t,r)&&n(e,t,r);return i(e,t),e},o=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,i,a=r.call(t),o=[];try{for(;(void 0===e||e-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o},s=this&&this.__spread||function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(o(arguments[e]));return t},u=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.searchFlatTree=e.makeLeafArray=e.makeForest=e.FlatTree=void 0;var h=a(r(8186)),l=function(t,e,r,n){this.hyperplanes=t,this.offsets=e,this.children=r,this.indices=n};function c(t,e,r,n,i){if(void 0===r&&(r=30),e.length>r){var a=function(t,e,r){var n=t[0].length,i=h.tauRandInt(e.length,r),a=h.tauRandInt(e.length,r);a=(a+=i===a?1:0)%e.length;for(var o=e[i],s=e[a],u=0,l=h.zeros(n),c=0;c<l.length;c++)l[c]=t[o][c]-t[s][c],u-=l[c]*(t[o][c]+t[s][c])/2;var f=0,p=0,d=h.zeros(e.length);for(c=0;c<e.length;c++){for(var m=u,v=0;v<n;v++)m+=l[v]*t[e[c]][v];0===m?(d[c]=h.tauRandInt(2,r),0===d[c]?f+=1:p+=1):m>0?(d[c]=0,f+=1):(d[c]=1,p+=1)}var g=h.zeros(f),y=h.zeros(p);for(f=0,p=0,c=0;c<d.length;c++)0===d[c]?(g[f]=e[c],f+=1):(y[p]=e[c],p+=1);return{indicesLeft:g,indicesRight:y,hyperplane:l,offset:u}}(t,e,i),o=a.indicesLeft,s=a.indicesRight,u=a.hyperplane,l=a.offset;return{leftChild:c(t,o,r,n+1,i),rightChild:c(t,s,r,n+1,i),isLeaf:!1,hyperplane:u,offset:l}}return{indices:e,isLeaf:!0}}function f(t,e,r,n,i,a,o){var u;if(t.isLeaf)return n[a][0]=-o,(u=i[o]).splice.apply(u,s([0,t.indices.length],t.indices)),{nodeNum:a,leafNum:o+=1};e[a]=t.hyperplane,r[a]=t.offset,n[a][0]=a+1;var h=a,l=f(t.leftChild,e,r,n,i,a+1,o);return a=l.nodeNum,o=l.leafNum,n[h][1]=a+1,{nodeNum:(l=f(t.rightChild,e,r,n,i,a+1,o)).nodeNum,leafNum:l.leafNum}}function p(t){return t.isLeaf?1:1+p(t.leftChild)+p(t.rightChild)}function d(t){return t.isLeaf?1:d(t.leftChild)+d(t.rightChild)}function m(t,e,r,n){for(var i=e,a=0;a<r.length;a++)i+=t[a]*r[a];return 0===i?h.tauRandInt(2,n):i>0?0:1}e.FlatTree=l,e.makeForest=function(t,e,r,n){var i=Math.max(10,e);return h.range(r).map((function(e,r){return function(t,e,r,n){return void 0===e&&(e=30),c(t,h.range(t.length),e,r,n)}(t,i,r,n)})).map((function(t){return function(t,e){var r=p(t),n=d(t),i=h.range(r).map((function(){return h.zeros(t.hyperplane?t.hyperplane.length:0)})),a=h.zeros(r),o=h.range(r).map((function(){return[-1,-1]})),s=h.range(n).map((function(){return h.range(e).map((function(){return-1}))}));return f(t,i,a,o,s,0,0),new l(i,a,o,s)}(t,i)}))},e.makeLeafArray=function(t){var e,r;if(t.length>0){var n=[];try{for(var i=u(t),a=i.next();!a.done;a=i.next()){var o=a.value;n.push.apply(n,s(o.indices))}}catch(t){e={error:t}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}return n}return[[-1]]},e.searchFlatTree=function(t,e,r){for(var n=0;e.children[n][0]>0;)n=0===m(e.hyperplanes[n],e.offsets[n],t,r)?e.children[n][0]:e.children[n][1];var i=-1*e.children[n][0];return e.indices[i]}},5112:function(t,e,r){var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.hasOwnProperty.call(t,r)&&n(e,t,r);return i(e,t),e},o=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,a){function o(t){try{u(n.next(t))}catch(t){a(t)}}function s(t){try{u(n.throw(t))}catch(t){a(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(o,s)}u((n=n.apply(t,e||[])).next())}))},s=this&&this.__generator||function(t,e){var r,n,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;o;)try{if(r=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,n=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(6===a[0]&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=e.call(t,o)}catch(t){a=[6,t],n=0}finally{r=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}},u=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,i,a=r.call(t),o=[];try{for(;(void 0===e||e-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o},h=this&&this.__spread||function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(u(arguments[e]));return t},l=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.initTransform=e.resetLocalConnectivity=e.fastIntersection=e.findABParams=e.cosine=e.euclidean=e.UMAP=void 0;var c=a(r(1853)),f=a(r(702)),p=a(r(2286)),d=a(r(3731)),m=a(r(8186)),v=l(r(5407)),g=1e-5,y=.001,b=function(){function t(t){var e=this;void 0===t&&(t={}),this.learningRate=1,this.localConnectivity=1,this.minDist=.1,this.nComponents=2,this.nEpochs=0,this.nNeighbors=15,this.negativeSampleRate=5,this.random=Math.random,this.repulsionStrength=1,this.setOpMixRatio=1,this.spread=1,this.transformQueueSize=4,this.targetMetric="categorical",this.targetWeight=.5,this.targetNNeighbors=this.nNeighbors,this.distanceFn=w,this.isInitialized=!1,this.rpForest=[],this.embedding=[],this.optimizationState=new S;var r=function(r){void 0!==t[r]&&(e[r]=t[r])};r("distanceFn"),r("learningRate"),r("localConnectivity"),r("minDist"),r("nComponents"),r("nEpochs"),r("nNeighbors"),r("negativeSampleRate"),r("random"),r("repulsionStrength"),r("setOpMixRatio"),r("spread"),r("transformQueueSize")}return t.prototype.fit=function(t){return this.initializeFit(t),this.optimizeLayout(),this.embedding},t.prototype.fitAsync=function(t,e){return void 0===e&&(e=function(){return!0}),o(this,void 0,void 0,(function(){return s(this,(function(r){switch(r.label){case 0:return this.initializeFit(t),[4,this.optimizeLayoutAsync(e)];case 1:return r.sent(),[2,this.embedding]}}))}))},t.prototype.setSupervisedProjection=function(t,e){void 0===e&&(e={}),this.Y=t,this.targetMetric=e.targetMetric||this.targetMetric,this.targetWeight=e.targetWeight||this.targetWeight,this.targetNNeighbors=e.targetNNeighbors||this.targetNNeighbors},t.prototype.setPrecomputedKNN=function(t,e){this.knnIndices=t,this.knnDistances=e},t.prototype.initializeFit=function(t){if(t.length<=this.nNeighbors)throw new Error("Not enough data points ("+t.length+") to create nNeighbors: "+this.nNeighbors+". Add more data points or adjust the configuration.");if(this.X===t&&this.isInitialized)return this.getNEpochs();if(this.X=t,!this.knnIndices&&!this.knnDistances){var e=this.nearestNeighbors(t);this.knnIndices=e.knnIndices,this.knnDistances=e.knnDistances}this.graph=this.fuzzySimplicialSet(t,this.nNeighbors,this.setOpMixRatio),this.makeSearchFns(),this.searchGraph=this.makeSearchGraph(t),this.processGraphForSupervisedProjection();var r=this.initializeSimplicialSetEmbedding(),n=r.head,i=r.tail,a=r.epochsPerSample;return this.optimizationState.head=n,this.optimizationState.tail=i,this.optimizationState.epochsPerSample=a,this.initializeOptimization(),this.prepareForOptimizationLoop(),this.isInitialized=!0,this.getNEpochs()},t.prototype.makeSearchFns=function(){var t=p.makeInitializations(this.distanceFn),e=t.initFromTree,r=t.initFromRandom;this.initFromTree=e,this.initFromRandom=r,this.search=p.makeInitializedNNSearch(this.distanceFn)},t.prototype.makeSearchGraph=function(t){for(var e=this.knnIndices,r=this.knnDistances,n=[t.length,t.length],i=new f.SparseMatrix([],[],[],n),a=0;a<e.length;a++)for(var o=e[a],s=r[a],u=0;u<o.length;u++){var h=o[u],l=s[u];l>0&&i.set(a,h,l)}var c=f.transpose(i);return f.maximum(i,c)},t.prototype.transform=function(t){var e=this,r=this.X;if(void 0===r||0===r.length)throw new Error("No data has been fit.");var n=Math.floor(this.nNeighbors*this.transformQueueSize);n=Math.min(r.length,n);var i=p.initializeSearch(this.rpForest,r,t,n,this.initFromRandom,this.initFromTree,this.random),a=this.search(r,this.searchGraph,i,t),o=c.deheapSort(a),s=o.indices,u=o.weights;s=s.map((function(t){return t.slice(0,e.nNeighbors)})),u=u.map((function(t){return t.slice(0,e.nNeighbors)}));var h=Math.max(0,this.localConnectivity-1),l=this.smoothKNNDistance(u,this.nNeighbors,h),d=l.sigmas,v=l.rhos,g=this.computeMembershipStrengths(s,u,d,v),y=g.rows,b=g.cols,w=g.vals,S=[t.length,r.length],M=new f.SparseMatrix(y,b,w,S),z=f.normalize(M,"l1"),_=f.getCSR(z),N=t.length,E=x(m.reshape2d(_.indices,N,this.nNeighbors),m.reshape2d(_.values,N,this.nNeighbors),this.embedding),k=this.nEpochs?this.nEpochs/3:M.nRows<=1e4?100:30,P=M.getValues().reduce((function(t,e){return e>t?e:t}),0);M=M.map((function(t){return t<P/k?0:t})),M=f.eliminateZeros(M);var O=this.makeEpochsPerSample(M.getValues(),k),R=M.getRows(),j=M.getCols();return this.assignOptimizationStateParameters({headEmbedding:E,tailEmbedding:this.embedding,head:R,tail:j,currentEpoch:0,nEpochs:k,nVertices:M.getDims()[1],epochsPerSample:O}),this.prepareForOptimizationLoop(),this.optimizeLayout()},t.prototype.processGraphForSupervisedProjection=function(){var t=this.Y,e=this.X;if(t){if(t.length!==e.length)throw new Error("Length of X and y must be equal");if("categorical"===this.targetMetric){var r=this.targetWeight<1?1/(1-this.targetWeight)*2.5:1e12;this.graph=this.categoricalSimplicialSetIntersection(this.graph,t,r)}}},t.prototype.step=function(){var t=this.optimizationState.currentEpoch;return t<this.getNEpochs()&&this.optimizeLayoutStep(t),this.optimizationState.currentEpoch},t.prototype.getEmbedding=function(){return this.embedding},t.prototype.nearestNeighbors=function(t){var e,r=this.distanceFn,n=this.nNeighbors,i=p.makeNNDescent(r,this.random),a=5+Math.floor(.5==(e=Math.pow(t.length,.5)/20)?0:Math.round(e)),o=Math.max(5,Math.floor(Math.round(function(t){return Math.log(t)/Math.log(2)}(t.length))));this.rpForest=d.makeForest(t,n,a,this.random);var s=i(t,d.makeLeafArray(this.rpForest),n,o);return{knnIndices:s.indices,knnDistances:s.weights}},t.prototype.fuzzySimplicialSet=function(t,e,r){void 0===r&&(r=1);var n=this,i=n.knnIndices,a=void 0===i?[]:i,o=n.knnDistances,s=void 0===o?[]:o,u=n.localConnectivity,h=this.smoothKNNDistance(s,e,u),l=h.sigmas,c=h.rhos,p=this.computeMembershipStrengths(a,s,l,c),d=p.rows,m=p.cols,v=p.vals,g=[t.length,t.length],y=new f.SparseMatrix(d,m,v,g),b=f.transpose(y),w=f.pairwiseMultiply(y,b),S=f.subtract(f.add(y,b),w),M=f.multiplyScalar(S,r),z=f.multiplyScalar(w,1-r);return f.add(M,z)},t.prototype.categoricalSimplicialSetIntersection=function(t,e,r,n){void 0===n&&(n=1);var i=N(t,e,n,r);return E(i=f.eliminateZeros(i))},t.prototype.smoothKNNDistance=function(t,e,r,n,i){void 0===r&&(r=1),void 0===n&&(n=64),void 0===i&&(i=1);for(var a=Math.log(e)/Math.log(2)*i,o=m.zeros(t.length),s=m.zeros(t.length),u=0;u<t.length;u++){var h=0,l=1/0,c=1,f=t[u],p=f.filter((function(t){return t>0}));if(p.length>=r){var d=Math.floor(r),v=r-d;d>0?(o[u]=p[d-1],v>g&&(o[u]+=v*(p[d]-p[d-1]))):o[u]=v*p[0]}else p.length>0&&(o[u]=m.max(p));for(var b=0;b<n;b++){for(var w=0,S=1;S<t[u].length;S++){var M=t[u][S]-o[u];w+=M>0?Math.exp(-M/c):1}if(Math.abs(w-a)<g)break;w>a?c=(h+(l=c))/2:(h=c,l===1/0?c*=2:c=(h+l)/2)}if(s[u]=c,o[u]>0){var z=m.mean(f);s[u]<y*z&&(s[u]=y*z)}else{var _=m.mean(t.map(m.mean));s[u]<y*_&&(s[u]=y*_)}}return{sigmas:s,rhos:o}},t.prototype.computeMembershipStrengths=function(t,e,r,n){for(var i=t.length,a=t[0].length,o=m.zeros(i*a),s=m.zeros(i*a),u=m.zeros(i*a),h=0;h<i;h++)for(var l=0;l<a;l++){var c=0;-1!==t[h][l]&&(c=t[h][l]===h?0:e[h][l]-n[h]<=0?1:Math.exp(-(e[h][l]-n[h])/r[h]),o[h*a+l]=h,s[h*a+l]=t[h][l],u[h*a+l]=c)}return{rows:o,cols:s,vals:u}},t.prototype.initializeSimplicialSetEmbedding=function(){for(var t=this,e=this.getNEpochs(),r=this.nComponents,n=this.graph.getValues(),i=0,a=0;a<n.length;a++){var o=n[a];i<n[a]&&(i=o)}var s=this.graph.map((function(t){return t<i/e?0:t}));this.embedding=m.zeros(s.nRows).map((function(){return m.zeros(r).map((function(){return 20*m.tauRand(t.random)-10}))}));var u=[],h=[],l=[],c=s.getAll();for(a=0;a<c.length;a++){var f=c[a];f.value&&(u.push(f.value),l.push(f.row),h.push(f.col))}return{head:h,tail:l,epochsPerSample:this.makeEpochsPerSample(u,e)}},t.prototype.makeEpochsPerSample=function(t,e){var r=m.filled(t.length,-1),n=m.max(t),i=t.map((function(t){return t/n*e}));return i.forEach((function(t,n){t>0&&(r[n]=e/i[n])})),r},t.prototype.assignOptimizationStateParameters=function(t){Object.assign(this.optimizationState,t)},t.prototype.prepareForOptimizationLoop=function(){var t=this,e=t.repulsionStrength,r=t.learningRate,n=t.negativeSampleRate,i=this.optimizationState,a=i.epochsPerSample,o=i.headEmbedding,s=i.tailEmbedding,u=o[0].length,l=o.length===s.length,c=a.map((function(t){return t/n})),f=h(c),p=h(a);this.assignOptimizationStateParameters({epochOfNextSample:p,epochOfNextNegativeSample:f,epochsPerNegativeSample:c,moveOther:l,initialAlpha:r,alpha:r,gamma:e,dim:u})},t.prototype.initializeOptimization=function(){var t=this.embedding,e=this.embedding,r=this.optimizationState,n=r.head,i=r.tail,a=r.epochsPerSample,o=this.getNEpochs(),s=this.graph.nCols,u=_(this.spread,this.minDist),h=u.a,l=u.b;this.assignOptimizationStateParameters({headEmbedding:t,tailEmbedding:e,head:n,tail:i,epochsPerSample:a,a:h,b:l,nEpochs:o,nVertices:s})},t.prototype.optimizeLayoutStep=function(t){for(var e=this.optimizationState,r=e.head,n=e.tail,i=e.headEmbedding,a=e.tailEmbedding,o=e.epochsPerSample,s=e.epochOfNextSample,u=e.epochOfNextNegativeSample,h=e.epochsPerNegativeSample,l=e.moveOther,c=e.initialAlpha,f=e.alpha,p=e.gamma,d=e.a,v=e.b,g=e.dim,y=e.nEpochs,b=e.nVertices,w=0;w<o.length;w++)if(!(s[w]>t)){var S=r[w],_=n[w],N=i[S],E=a[_],x=z(N,E),k=0;x>0&&(k=-2*d*v*Math.pow(x,v-1),k/=d*Math.pow(x,v)+1);for(var P=0;P<g;P++){var O=M(k*(N[P]-E[P]),4);N[P]+=O*f,l&&(E[P]+=-O*f)}s[w]+=o[w];for(var R=Math.floor((t-u[w])/h[w]),j=0;j<R;j++){var C=m.tauRandInt(b,this.random),F=a[C],A=z(N,F),D=0;if(A>0)D=2*p*v,D/=(.001+A)*(d*Math.pow(A,v)+1);else if(S===C)continue;for(P=0;P<g;P++)O=4,D>0&&(O=M(D*(N[P]-F[P]),4)),N[P]+=O*f}u[w]+=R*h[w]}return e.alpha=c*(1-t/y),e.currentEpoch+=1,i},t.prototype.optimizeLayoutAsync=function(t){var e=this;return void 0===t&&(t=function(){return!0}),new Promise((function(r,n){var i=function(){return o(e,void 0,void 0,(function(){var e,a,o,u,h,l;return s(this,(function(s){try{if(e=this.optimizationState,a=e.nEpochs,o=e.currentEpoch,this.embedding=this.optimizeLayoutStep(o),u=this.optimizationState.currentEpoch,h=!1===t(u),l=u===a,h||l)return[2,r(l)];setTimeout((function(){return i()}),0)}catch(t){n(t)}return[2]}))}))};setTimeout((function(){return i()}),0)}))},t.prototype.optimizeLayout=function(t){void 0===t&&(t=function(){return!0});for(var e=!1,r=[];!e;){var n=this.optimizationState,i=n.nEpochs,a=n.currentEpoch;r=this.optimizeLayoutStep(a);var o=this.optimizationState.currentEpoch,s=!1===t(o);e=o===i||s}return r},t.prototype.getNEpochs=function(){var t=this.graph;if(this.nEpochs>0)return this.nEpochs;var e=t.nRows;return e<=2500?500:e<=5e3?400:e<=7500?300:200},t}();function w(t,e){for(var r=0,n=0;n<t.length;n++)r+=Math.pow(t[n]-e[n],2);return Math.sqrt(r)}e.UMAP=b,e.euclidean=w,e.cosine=function(t,e){for(var r=0,n=0,i=0,a=0;a<t.length;a++)r+=t[a]*e[a],n+=Math.pow(t[a],2),i+=Math.pow(e[a],2);return 0===n&&0===i?0:0===n||0===i?1:1-r/Math.sqrt(n*i)};var S=function(){this.currentEpoch=0,this.headEmbedding=[],this.tailEmbedding=[],this.head=[],this.tail=[],this.epochsPerSample=[],this.epochOfNextSample=[],this.epochOfNextNegativeSample=[],this.epochsPerNegativeSample=[],this.moveOther=!0,this.initialAlpha=1,this.alpha=1,this.gamma=1,this.a=1.5769434603113077,this.b=.8950608779109733,this.dim=2,this.nEpochs=500,this.nVertices=0};function M(t,e){return t>e?e:t<-e?-e:t}function z(t,e){for(var r=0,n=0;n<t.length;n++)r+=Math.pow(t[n]-e[n],2);return r}function _(t,e){var r=m.linear(0,3*t,300).map((function(t){return t<e?1:t})),n=m.zeros(r.length).map((function(n,i){return r[i]>=e?Math.exp(-(r[i]-e)/t):n})),i={x:r,y:n},a=v.default(i,(function(t){var e=u(t,2),r=e[0],n=e[1];return function(t){return 1/(1+r*Math.pow(t,2*n))}}),{damping:1.5,initialValues:[.5,.5],gradientDifference:.1,maxIterations:100,errorTolerance:.01}).parameterValues,o=u(a,2);return{a:o[0],b:o[1]}}function N(t,e,r,n){return void 0===r&&(r=1),void 0===n&&(n=5),t.map((function(t,i,a){return-1===e[i]||-1===e[a]?t*Math.exp(-r):e[i]!==e[a]?t*Math.exp(-n):t}))}function E(t){t=f.normalize(t,"max");var e=f.transpose(t),r=f.pairwiseMultiply(e,t);return t=f.add(t,f.subtract(e,r)),f.eliminateZeros(t)}function x(t,e,r){for(var n=m.zeros(t.length).map((function(t){return m.zeros(r[0].length)})),i=0;i<t.length;i++)for(var a=0;a<t[0].length;a++)for(var o=0;o<r[0].length;o++){var s=t[i][a];n[i][o]+=e[i][a]*r[s][o]}return n}e.findABParams=_,e.fastIntersection=N,e.resetLocalConnectivity=E,e.initTransform=x},5407:(t,e,r)=>{r.r(e),r.d(e,{default:()=>u});const n=Object.prototype.toString;function i(t){return n.call(t).endsWith("Array]")}function a(t,e,r){let n=0;const i=r(e);for(let e=0;e<t.x.length;e++)n+=Math.abs(t.y[e]-i(t.x[e]));return n}var o=r(5907);function s(t,e,r,n,i){let a=r*n*n,s=o.uq.eye(e.length,e.length,a);const u=i(e);let h=new Float64Array(t.x.length);for(let e=0;e<t.x.length;e++)h[e]=u(t.x[e]);let l=function(t,e,r,n,i){const a=r.length,s=t.x.length;let u=new Array(a);for(let o=0;o<a;o++){u[o]=new Array(s);let a=r.slice();a[o]+=n;let h=i(a);for(let r=0;r<s;r++)u[o][r]=e[r]-h(t.x[r])}return new o.uq(u)}(t,h,e,n,i),c=function(t,e){const r=t.x.length;let n=new Array(r);for(let i=0;i<r;i++)n[i]=[t.y[i]-e[i]];return new o.uq(n)}(t,h),f=(0,o.DI)(s.add(l.mmul(l.transpose())));return(e=(e=new o.uq([e])).sub(f.mmul(l).mmul(c).mul(n).transpose())).to1DArray()}function u(t,e,r={}){let{maxIterations:n=100,gradientDifference:o=.1,damping:u=0,errorTolerance:h=.01,minValues:l,maxValues:c,initialValues:f}=r;if(u<=0)throw new Error("The damping option must be a positive number");if(!t.x||!t.y)throw new Error("The data parameter must have x and y elements");if(!i(t.x)||t.x.length<2||!i(t.y)||t.y.length<2)throw new Error("The data parameter elements must be an array with more than 2 points");if(t.x.length!==t.y.length)throw new Error("The data parameter elements must have the same size");let p=f||new Array(e.length).fill(1),d=p.length;if(c=c||new Array(d).fill(Number.MAX_SAFE_INTEGER),l=l||new Array(d).fill(Number.MIN_SAFE_INTEGER),c.length!==l.length)throw new Error("minValues and maxValues must be the same size");if(!i(p))throw new Error("initialValues must be an array");let m,v=a(t,p,e),g=v<=h;for(m=0;m<n&&!g;m++){p=s(t,p,u,o,e);for(let t=0;t<d;t++)p[t]=Math.min(Math.max(l[t],p[t]),c[t]);if(v=a(t,p,e),isNaN(v))break;g=v<=h}return{parameterValues:p,parameterError:v,iterations:m}}},8186:function(t,e){var r=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};function n(t,e){return Math.floor(e()*t)}function i(t){for(var e=[],r=0;r<t;r++)e.push(void 0);return e}function a(t,e){return i(t).map((function(){return e}))}function o(t){return a(t,0)}function s(t){return t.reduce((function(t,e){return t+e}))}Object.defineProperty(e,"__esModule",{value:!0}),e.reshape2d=e.rejectionSample=e.max2d=e.max=e.mean=e.sum=e.linear=e.ones=e.zeros=e.filled=e.range=e.empty=e.norm=e.tauRand=e.tauRandInt=void 0,e.tauRandInt=n,e.tauRand=function(t){return t()},e.norm=function(t){var e,n,i=0;try{for(var a=r(t),o=a.next();!o.done;o=a.next()){var s=o.value;i+=Math.pow(s,2)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(n=a.return)&&n.call(a)}finally{if(e)throw e.error}}return Math.sqrt(i)},e.empty=i,e.range=function(t){return i(t).map((function(t,e){return e}))},e.filled=a,e.zeros=o,e.ones=function(t){return a(t,1)},e.linear=function(t,e,r){return i(r).map((function(n,i){return t+i*((e-t)/(r-1))}))},e.sum=s,e.mean=function(t){return s(t)/t.length},e.max=function(t){for(var e=0,r=0;r<t.length;r++)e=t[r]>e?t[r]:e;return e},e.max2d=function(t){for(var e=0,r=0;r<t.length;r++)for(var n=0;n<t[r].length;n++)e=t[r][n]>e?t[r][n]:e;return e},e.rejectionSample=function(t,e,r){for(var i=o(t),a=0;a<t;a++)for(var s=!0;s;){for(var u=n(e,r),h=!1,l=0;l<a;l++)if(u===i[l]){h=!0;break}h||(s=!1),i[a]=u}return i},e.reshape2d=function(t,e,r){var n=[],i=0;if(t.length!==e*r)throw new Error("Array dimensions must match input length.");for(var a=0;a<e;a++){for(var o=[],s=0;s<r;s++)o.push(t[i]),i+=1;n.push(o)}return n}}}]);
|
|
2
2
|
//# sourceMappingURL=415.js.map
|