Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    linear-autoscalepublic

    linear-autoscale

    example

    example.js:

    var autoscale = require('./index');
     
    var t = autoscale();
     
    var dataset = [-50, 12, 40, 26];
     
    console.log('d: %j', dataset);
    console.log('f(d): %j', t(dataset));
    console.log('f_inv(f(d)): %j (expect some numerical decay here)',
      t(dataset).inv(t(dataset))
    );

    output:

    $ node example.js 
    d: [-50,12,40,26]
    f(d): [0,0.6888888888888889,1,0.8444444444444446]
    f_inv(f(d)): [-50,11.999999999999996,39.99999999999999,26.000000000000007]
    josh@onix:/tmp/scale$ node example.js 
    d: [-50,12,40,26]
    f(d): [0,0.6888888888888889,1,0.8444444444444446]
    f_inv(f(d)): [-50,11.999999999999996,39.99999999999999,26.000000000000007] (expect some numerical decay here)
    $
    

    license

    MIT/X11

    install

    npm i linear-autoscale

    Downloadsweekly downloads

    2

    version

    0.0.0

    license

    MIT/X11

    last publish

    collaborators

    • avatar
    • avatar