StackGenVis: Alignment of Data, Algorithms, and Models for Stacking Ensemble Learning Using Performance Metrics
https://doi.org/10.1109/TVCG.2020.3030352
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.
4 lines
16 KiB
4 lines
16 KiB
4 years ago
|
// https://github.com/d3/d3-delaunay v5.2.0 Copyright 2020 Mike Bostock
|
||
|
// https://github.com/mapbox/delaunator v4.0.1. Copyright 2019 Mapbox, Inc.
|
||
|
!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports):"function"==typeof define&&define.amd?define(["exports"],i):i((t=t||self).d3=t.d3||{})}(this,function(t){"use strict";const i=Math.pow(2,-52),e=new Uint32Array(512);class n{static from(t,i=u,e=_){const s=t.length,h=new Float64Array(2*s);for(let n=0;n<s;n++){const s=t[n];h[2*n]=i(s),h[2*n+1]=e(s)}return new n(h)}constructor(t){const i=t.length>>1;if(i>0&&"number"!=typeof t[0])throw new Error("Expected coords to contain numbers.");this.coords=t;const e=Math.max(2*i-5,0);this._triangles=new Uint32Array(3*e),this._halfedges=new Int32Array(3*e),this._hashSize=Math.ceil(Math.sqrt(i)),this._hullPrev=new Uint32Array(i),this._hullNext=new Uint32Array(i),this._hullTri=new Uint32Array(i),this._hullHash=new Int32Array(this._hashSize).fill(-1),this._ids=new Uint32Array(i),this._dists=new Float64Array(i),this.update()}update(){const{coords:t,_hullPrev:e,_hullNext:n,_hullTri:h,_hullHash:r}=this,c=t.length>>1;let u=1/0,_=1/0,f=-1/0,d=-1/0;for(let i=0;i<c;i++){const e=t[2*i],n=t[2*i+1];e<u&&(u=e),n<_&&(_=n),e>f&&(f=e),n>d&&(d=n),this._ids[i]=i}const g=(u+f)/2,y=(_+d)/2;let m,x,p,w=1/0;for(let i=0;i<c;i++){const e=s(g,y,t[2*i],t[2*i+1]);e<w&&(m=i,w=e)}const v=t[2*m],b=t[2*m+1];w=1/0;for(let i=0;i<c;i++){if(i===m)continue;const e=s(v,b,t[2*i],t[2*i+1]);e<w&&e>0&&(x=i,w=e)}let T=t[2*x],A=t[2*x+1],M=1/0;for(let i=0;i<c;i++){if(i===m||i===x)continue;const e=o(v,b,T,A,t[2*i],t[2*i+1]);e<M&&(p=i,M=e)}let k=t[2*p],$=t[2*p+1];if(M===1/0){for(let i=0;i<c;i++)this._dists[i]=t[2*i]-t[0]||t[2*i+1]-t[1];a(this._ids,this._dists,0,c-1);const i=new Uint32Array(c);let e=0;for(let t=0,n=-1/0;t<c;t++){const s=this._ids[t];this._dists[s]>n&&(i[e++]=s,n=this._dists[s])}return this.hull=i.subarray(0,e),this.triangles=new Uint32Array(0),void(this.halfedges=new Uint32Array(0))}if(l(v,b,T,A,k,$)){const t=x,i=T,e=A;x=p,T=k,A=$,p=t,k=i,$=e}const P=function(t,i,e,n,s,h){const l=e-t,r=n-i,o=s-t,a=h-i,c=l*l+r*r,u=o*o+a*a,_=.5/(l*a-r*o);return{x:t+(a*c-r*u)*_,y:i+(l*u-o*c)*_}}(v,b,T,A,k,$);this._cx=P.x,this._cy=P.y;for(let i=0;i<c;i++)this._dists[i]=s(t[2*i],t[2*i+1],P.x,P.y);a(this._ids,this._dists,0,c-1),this._hullStart=m;let S=3;n[m]=e[p]=x,n[x]=e[m]=p,n[p]=e[x]=m,h[m]=0,h[x]=1,h[p]=2,r.fill(-1),r[this._hashKey(v,b)]=m,r[this._hashKey(T,A)]=x,r[this._hashKey(k,$)]=p,this.trianglesLen=0,this._addTriangle(m,x,p,-1,-1,-1);for(let s,o,a=0;a<this._ids.length;a++){const c=this._ids[a],u=t[2*c],_=t[2*c+1];if(a>0&&Math.abs(u-s)<=i&&Math.abs(_-o)<=i)continue;if(s=u,o=_,c===m||c===x||c===p)continue;let f=0;for(let t=0,i=this._hashKey(u,_);t<this._hashSize&&(-1===(f=r[(i+t)%this._hashSize])||f===n[f]);t++);let d,g=f=e[f];for(;d=n[g],!l(u,_,t[2*g],t[2*g+1],t[2*d],t[2*d+1]);)if((g=d)===f){g=-1;break}if(-1===g)continue;let y=this._addTriangle(g,c,n[g],-1,-1,h[g]);h[c]=this._legalize(y+2),h[g]=y,S++;let w=n[g];for(;d=n[w],l(u,_,t[2*w],t[2*w+1],t[2*d],t[2*d+1]);)y=this._addTriangle(w,c,d,h[c],-1,h[w]),h[c]=this._legalize(y+2),n[w]=w,S--,w=d;if(g===f)for(;l(u,_,t[2*(d=e[g])],t[2*d+1],t[2*g],t[2*g+1]);)y=this._addTriangle(d,c,g,-1,h[g],h[d]),this._legalize(y+2),h[d]=y,n[g]=g,S--,g=d;this._hullStart=e[c]=g,n[g]=e[w]=c,n[c]=w,r[this._hashKey(u,_)]=c,r[this._hashKey(t[2*g],t[2*g+1])]=g}this.hull=new Uint32Array(S);for(let t=0,i=this._hullStart;t<S;t++)this.hull[t]=i,i=n[i];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(t,i){return Math.floor(function(t,i){const e=t/(Math.abs(t)+Math.abs(i));return(i>0?3-e:1+e)/4}(t-this._cx,i-this._cy)*this._hashSize)%this._hashSize}_legalize(t){const{_triangles:i,_halfedges:n,coords:s}=this;let h=0,l=0;for(;;){const o=n[t],a=t-t%3;if(l=a+(t+2)%3,-1===o){if(0===h)break;t=e[--h];continue}const c=o-o%3,u=a+(t+1)%3,_=c+(o+2)%3,f=i[l],d=i[t],g=i[u],y=i[_];if(r(s[2*f],s[2*f+1],s[2*d],s[2*d+1],s[2*g],s[2*g+1],s[2*y],s[2*y+1])){i[t]=y,i[o]=f;const s=n[_];if(-1===s){let i=this._hullStart;do{if(this._hullTri[i]===_){this._hullTri[i]=t;break}i=this._hullPrev[i]}while(i!==this._hullStart)}this._link(t,s
|