You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
amis/demo/scripts/chunk/8448.7edbd673.js

1 line
15 KiB

1 year ago
(self.webpackChunkamis_editor_demo=self.webpackChunkamis_editor_demo||[]).push([[8448],{96063:function(n){var r;r=function(){return function(n){var r={};function t(e){if(r[e])return r[e].exports;var o=r[e]={exports:{},id:e,loaded:!1};return n[e].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}return t.m=n,t.c=r,t.p="",t(0)}([function(n,r,t){var e;void 0===(e=function(n){return{clustering:t(1),regression:t(5),statistics:t(6),histogram:t(15),transform:{regression:t(18),histogram:t(21),clustering:t(22)}}}.call(r,t,r,n))||(n.exports=e)},function(n,r,t){var e;void 0===(e=function(n){var r=t(2),e=r.dataPreprocess,o=r.normalizeDimensions,i=t(3),a=t(4),u=i.size,s=i.sumOfColumn,l=i.sum,f=i.zeros,c=(a=t(4)).isNumber,h=Math.pow,p={SINGLE:"single",MULTIPLE:"multiple"};function d(n,r,t){for(var e,o,i,a,u=f(n.length,2),s=function(n,r){for(var t=f(n,r.length),e=0;e<r.length;e++)for(var o=r[e],i=0;i<n;i++)t[i][e]=o.min+o.span*Math.random();return t}(r,x(n,t.dimensions)),l=!0;l;){l=!1;for(var c=0;c<n.length;c++){e=1/0,o=-1;for(var h=0;h<r;h++)(i=g(n[c],s[h],t))<e&&(e=i,o=h);u[c][0]!==o&&(l=!0),u[c][0]=o,u[c][1]=e}for(c=0;c<r;c++){for(a=[],h=0;h<u.length;h++)u[h][0]===c&&a.push(n[h]);s[c]=v(a,t)}}return{centroids:s,clusterAssigned:u}}function v(n,r){for(var t,e,o=[],i=0;i<r.dimensions.length;i++){var a=r.dimensions[i];t=0;for(var u=0;u<n.length;u++)t+=n[u][a];e=t/n.length,o.push(e)}return o}function m(n,r){var t=r.outputCentroidDimensions;if(r.outputType===p.SINGLE&&null!=t)for(var e=n.data,o=n.centroids,i=0;i<e.length;i++)for(var a=e[i],u=o[a[r.outputClusterIndexDimension]],s=Math.min(u.length,t.length),l=0;l<s;l++)a[t[l]]=u[l]}function g(n,r,t){for(var e=0,o=t.dimensions,i=t.rawExtents,a=0;a<o.length;a++){var u=i[a].span;if(u){var s=(n[o[a]]-r[a])/u;e+=h(s,2)}}return e}function x(n,r){for(var t=[],e=r.length,o=0;o<e;o++)t.push({min:1/0,max:-1/0});for(o=0;o<n.length;o++)for(var i=n[o],a=0;a<e;a++){var u=t[a],s=i[r[a]];u.min>s&&(u.min=s),u.max<s&&(u.max=s)}for(o=0;o<e;o++)t[o].span=t[o].max-t[o].min;return t}return{OutputType:p,hierarchicalKMeans:function(n,r,t){var i=(c(r)?{clusterCount:r,stepByStep:t}:r)||{clusterCount:2},h=i.clusterCount;if(!(h<2)){var M,y,w,D=function(n,r){var t=u(n);if(t.length<1)throw new Error("The input data of clustering should be two-dimension array.");for(var e=t[1],i=[],s=0;s<e;s++)i.push(s);var l=o(r.dimensions,i),f=r.outputType||p.MULTIPLE,c=r.outputClusterIndexDimension;if(f===p.SINGLE&&!a.isNumber(c))throw new Error("outputClusterIndexDimension is required as a number.");return{dimensions:l,rawExtents:x(n,l),outputType:f,outputClusterIndexDimension:c,outputCentroidDimensions:r.outputCentroidDimensions}}(n,i),b=D.outputType===p.SINGLE,E=e(n,{dimensions:D.dimensions}),N=f(E.length,2);if(b){M=[];var C=D.outputClusterIndexDimension;y=function(n,r){M[n][C]=r},w=function(n){return M[n][C]};for(var I=0;I<E.length;I++)M.push(E[I].slice()),V(I,0),y(I,0)}else y=function(n,r){N[n][0]=r},w=function(n){return N[n][0]};var A,O,z,S,q,P,L=v(E,D),T=[L];for(I=0;I<E.length;I++)V(I,g(E[I],L,D));var F=1,j={data:M,centroids:T,isEnd:!1};if(b||(j.clusterAssment=N),i.stepByStep)j.next=function(){return G(),m(j,D),j};else for(;G(),!j.isEnd;);return m(j,D),j}function V(n,r){N[n][1]=r}function G(){if(F<h){var n,r,t;A=1/0;for(var e=0;e<T.length;e++){O=[],z=[];for(var o=0;o<E.length;o++)w(o)===e?O.push(E[o]):z.push(N[o][1]);S=d(O,2,D),q=s(S.clusterAssigned,1),P=l(z),q+P<A&&(A=P+q,n=e,r=S.centroids,t=S.clusterAssigned)}for(o=0;o<t.length;o++)0===t[o][0]?t[o][0]=n:1===t[o][0]&&(t[o][0]=T.length);for(T[n]=r[0],T.push(r[1]),o=0,e=0;o<E.length&&e<t.length;o++)w(o)===n&&(y(o,t[e][0]),V(o,t[e++][1]));var i=[];if(!b){for(o=0;o<T.length;o++)for(i[o]=[],e=0;e<E.length;e++)w(e)===o&&i[o].push(E[e]);j.pointsInCluster=i}F++}else j.isEnd=!0}}}}.call(r,t,r,n))||(n.exports=e)},function(n,r,t){var e;void 0===(e=function(n){var r=t(3),e=r.isArray,o=r.size,i=t(4).isNumber;return{normalizeDimensions:function(n,r){return"number"==typeof n?[n]:null==n?r:n},dataPreprocess:function(n,r){var t=(r=r||{}).dimensions,a={};if(null!=t)for(var u=0;u<t.length;u+