Download datasets.js from elvis-hf/ensemble: direct link, hf CLI and curl.
- Browser
- Download file 1.55 kB
-
https://huggingface.co/spaces/elvis-hf/ensemble/resolve/main/datasets.js
- Command line
-
hf download hf://spaces/elvis-hf/ensemble/datasets.js
-
curl -L -o datasets.js https://huggingface.co/spaces/elvis-hf/ensemble/resolve/main/datasets.js
1.55 kB
| /* Deterministic presets available before the Python runtime has loaded. */ | |
| (function(root){ | |
| function create(type){ | |
| const points=[]; | |
| const add=(x,y,label)=>points.push({x,y,label}); | |
| if(type==='xor') return [ | |
| {x:0.1,y:0.9,label:-1},{x:0.9,y:0.1,label:-1}, | |
| {x:0.1,y:0.1,label:1},{x:0.9,y:0.9,label:1}, | |
| ]; | |
| if(type==='two_moons') for(let i=0;i<36;i++){ | |
| const t=i/35*Math.PI; | |
| add(.36+.28*Math.cos(t),.49+.28*Math.sin(t),-1); | |
| add(.64+.28*Math.cos(t),.51-.28*Math.sin(t),1); | |
| } | |
| if(type==='circles') for(let i=0;i<60;i++){ | |
| const t=i/60*2*Math.PI; | |
| for(const [r,label] of [[.18,-1],[.38,1]]) add(.5+r*Math.cos(t),.5+r*Math.sin(t),label); | |
| } | |
| if(type==='blobs'){ | |
| // Fixed Gaussian samples keep the same dataset on every selection. | |
| let seed=42; | |
| const random=()=>{seed=(Math.imul(1664525,seed)+1013904223)>>>0;return (seed+.5)/4294967296;}; | |
| for(const [cx,cy,label] of [[.25,.3,-1],[.75,.3,1],[.5,.75,2]]) for(let i=0;i<40;i++){ | |
| const r=.065*Math.sqrt(-2*Math.log(random())),t=2*Math.PI*random(); | |
| add(Math.max(.02,Math.min(.98,cx+r*Math.cos(t))),Math.max(.02,Math.min(.98,cy+r*Math.sin(t))),label); | |
| } | |
| } | |
| if(type==='spirals') for(let i=0;i<70;i++){ | |
| const r=.04+.4*i/69,t=i/69*2*Math.PI; | |
| add(.5+r*Math.cos(t),.5+r*Math.sin(t),-1); | |
| add(.5-r*Math.cos(t),.5-r*Math.sin(t),1); | |
| } | |
| return points; | |
| } | |
| const api={create}; | |
| if(typeof module!=='undefined')module.exports=api;else root.Datasets=api; | |
| })(globalThis); | |