{"_id":"pdfast","_rev":"3328902","name":"pdfast","description":"Fast kernel density estimation library","dist-tags":{"latest":"0.2.0"},"maintainers":[{"name":"gyosh","email":""}],"time":{"modified":"2024-07-10T07:06:27.000Z","created":"2016-08-11T17:26:47.207Z","0.2.0":"2016-09-01T17:06:38.477Z","0.1.2":"2016-08-26T13:52:57.436Z","0.1.1":"2016-08-17T07:35:10.339Z","0.1.0":"2016-08-17T06:52:04.737Z","0.0.5":"2016-08-13T14:17:01.787Z","0.0.4":"2016-08-13T02:19:05.674Z","0.0.3":"2016-08-11T17:59:25.661Z","0.0.2":"2016-08-11T17:56:53.796Z","0.0.1":"2016-08-11T17:26:47.207Z"},"users":{},"author":{"name":"William Gozali","email":"will.gozali@gmail.com"},"repository":{"type":"git","url":"git+https://github.com/gyosh/pdfast.git"},"versions":{"0.2.0":{"name":"pdfast","version":"0.2.0","description":"Fast kernel density estimation library","main":"src/index.js","keywords":["pdf","kde","probabilty","density","function","estimation","kernel","estimator"],"repository":{"type":"git","url":"git+https://github.com/gyosh/pdfast.git"},"bugs":{"url":"https://github.com/gyosh/pdfast"},"homepage":"https://github.com/gyosh/pdfast","scripts":{"test":"mocha --timeout 10000 $(find tests -name *.spec.js)"},"author":{"name":"William Gozali","email":"will.gozali@gmail.com"},"license":"MIT","devDependencies":{"chai":"^3.5.0","lodash":"^4.14.2","mocha":"^3.0.2","rewire":"^2.5.2"},"gitHead":"6b0d5c2830b8e00fd11e2561aeb267df5166ded0","_id":"pdfast@0.2.0","_shasum":"8cbc556e1bf2522177787c0de2e0d4373ba885c9","_from":".","_npmVersion":"3.7.1","_nodeVersion":"4.2.2","_npmUser":{"name":"gyosh","email":"will.gozali@gmail.com"},"dist":{"shasum":"8cbc556e1bf2522177787c0de2e0d4373ba885c9","size":5788,"noattachment":false,"key":"/pdfast/-/pdfast-0.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/pdfast/download/pdfast-0.2.0.tgz"},"maintainers":[{"name":"gyosh","email":""}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/pdfast-0.2.0.tgz_1472749598248_0.8701685892883688"},"directories":{},"publish_time":1472749598477,"_hasShrinkwrap":false,"_cnpm_publish_time":1472749598477,"_cnpmcore_publish_time":"2021-12-16T16:43:08.771Z"},"0.1.2":{"name":"pdfast","version":"0.1.2","description":"Fast kernel density estimation library","main":"src/index.js","keywords":["pdf","probabilty","density","function","estimation","kernel"],"repository":{"type":"git","url":"git+https://github.com/gyosh/pdfast.git"},"bugs":{"url":"https://github.com/gyosh/pdfast"},"homepage":"https://github.com/gyosh/pdfast","scripts":{"test":"mocha --timeout 10000 $(find tests -name *.spec.js)"},"author":{"name":"William Gozali","email":"will.gozali@gmail.com"},"license":"MIT","devDependencies":{"chai":"^3.5.0","lodash":"^4.14.2","mocha":"^3.0.2","rewire":"^2.5.2"},"gitHead":"81144acd190e33ab01e5bc0345871d47416432e6","_id":"pdfast@0.1.2","_shasum":"75743dc5863b8759340de2cf50de9cc3ad30a69a","_from":".","_npmVersion":"3.7.1","_nodeVersion":"4.2.2","_npmUser":{"name":"gyosh","email":"will.gozali@gmail.com"},"dist":{"shasum":"75743dc5863b8759340de2cf50de9cc3ad30a69a","size":5531,"noattachment":false,"key":"/pdfast/-/pdfast-0.1.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/pdfast/download/pdfast-0.1.2.tgz"},"maintainers":[{"name":"gyosh","email":""}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/pdfast-0.1.2.tgz_1472219577204_0.39470195514149964"},"directories":{},"publish_time":1472219577436,"_hasShrinkwrap":false,"_cnpm_publish_time":1472219577436,"_cnpmcore_publish_time":"2021-12-16T16:43:09.018Z"},"0.1.1":{"name":"pdfast","version":"0.1.1","description":"Fast kernel density estimation library","main":"src/index.js","keywords":["pdf","probabilty","density","function","estimation","kernel"],"repository":{"type":"git","url":"git+https://github.com/gyosh/pdfast.git"},"bugs":{"url":"https://github.com/gyosh/pdfast"},"homepage":"https://github.com/gyosh/pdfast","scripts":{"test":"mocha --timeout 10000 $(find tests -name *.spec.js)"},"author":{"name":"William Gozali","email":"will.gozali@gmail.com"},"license":"MIT","devDependencies":{"chai":"^3.5.0","lodash":"^4.14.2","mocha":"^3.0.2","rewire":"^2.5.2"},"gitHead":"e504d897106417129086eb135ba0c73e968ae085","_id":"pdfast@0.1.1","_shasum":"7d8d63c04d0a4d86321e1b858c6c2239c4474da2","_from":".","_npmVersion":"3.7.1","_nodeVersion":"4.2.2","_npmUser":{"name":"gyosh","email":"will.gozali@gmail.com"},"dist":{"shasum":"7d8d63c04d0a4d86321e1b858c6c2239c4474da2","size":5002,"noattachment":false,"key":"/pdfast/-/pdfast-0.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/pdfast/download/pdfast-0.1.1.tgz"},"maintainers":[{"name":"gyosh","email":""}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/pdfast-0.1.1.tgz_1471419310088_0.8856011240277439"},"directories":{},"publish_time":1471419310339,"_hasShrinkwrap":false,"_cnpm_publish_time":1471419310339,"_cnpmcore_publish_time":"2021-12-16T16:43:09.230Z"},"0.1.0":{"name":"pdfast","version":"0.1.0","description":"Fast kernel density estimation library","main":"src/index.js","keywords":["pdf","probabilty","density","function","estimation","kernel"],"repository":{"type":"git","url":"git+https://github.com/gyosh/pdfast.git"},"bugs":{"url":"https://github.com/gyosh/pdfast"},"homepage":"https://github.com/gyosh/pdfast","scripts":{"test":"mocha --timeout 10000 $(find tests -name *.spec.js)"},"author":{"name":"William Gozali","email":"will.gozali@gmail.com"},"license":"MIT","devDependencies":{"chai":"^3.5.0","lodash":"^4.14.2","mocha":"^3.0.2","rewire":"^2.5.2"},"gitHead":"419d5eac3b54fae839a59bf78ce6c4af0e05adf3","_id":"pdfast@0.1.0","_shasum":"fada64f5857fae288f3e9f76729cd6574f5f0b59","_from":".","_npmVersion":"3.7.1","_nodeVersion":"4.2.2","_npmUser":{"name":"gyosh","email":"will.gozali@gmail.com"},"dist":{"shasum":"fada64f5857fae288f3e9f76729cd6574f5f0b59","size":4802,"noattachment":false,"key":"/pdfast/-/pdfast-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/pdfast/download/pdfast-0.1.0.tgz"},"maintainers":[{"name":"gyosh","email":""}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/pdfast-0.1.0.tgz_1471416724458_0.13233372708782554"},"directories":{},"publish_time":1471416724737,"_hasShrinkwrap":false,"_cnpm_publish_time":1471416724737,"_cnpmcore_publish_time":"2021-12-16T16:43:09.441Z"},"0.0.5":{"name":"pdfast","version":"0.0.5","description":"Fast kernel density estimation library","main":"src/index.js","keywords":["pdf","probabilty","density","function","estimation","kernel"],"repository":{"type":"git","url":"git+https://github.com/gyosh/pdfast.git"},"bugs":{"url":"https://github.com/gyosh/pdfast"},"homepage":"https://github.com/gyosh/pdfast","scripts":{"test":"mocha --timeout 10000 $(find tests -name *.spec.js)"},"author":{"name":"William Gozali","email":"will.gozali@gmail.com"},"license":"MIT","devDependencies":{"chai":"^3.5.0","lodash":"^4.14.2","mocha":"^3.0.2","rewire":"^2.5.2"},"gitHead":"44711dc3fd49cb98e72c5cb3174799eacb2dba3b","_id":"pdfast@0.0.5","_shasum":"68de6322604864598ff9e3f5fd908524d914ac39","_from":".","_npmVersion":"3.7.1","_nodeVersion":"4.2.2","_npmUser":{"name":"gyosh","email":"will.gozali@gmail.com"},"dist":{"shasum":"68de6322604864598ff9e3f5fd908524d914ac39","size":4575,"noattachment":false,"key":"/pdfast/-/pdfast-0.0.5.tgz","tarball":"http://registry.cnpm.dingdandao.com/pdfast/download/pdfast-0.0.5.tgz"},"maintainers":[{"name":"gyosh","email":""}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/pdfast-0.0.5.tgz_1471097818928_0.9628156188409775"},"directories":{},"publish_time":1471097821787,"_hasShrinkwrap":false,"_cnpm_publish_time":1471097821787,"_cnpmcore_publish_time":"2021-12-16T16:43:09.647Z"},"0.0.4":{"name":"pdfast","version":"0.0.4","description":"Fast kernel density estimation library","main":"src/index.js","keywords":["pdf","probabilty","density","function","estimation","kernel"],"repository":{"type":"git","url":"git+https://github.com/gyosh/pdfast.git"},"bugs":{"url":"https://github.com/gyosh/pdfast"},"homepage":"https://github.com/gyosh/pdfast","scripts":{"test":"mocha --timeout 10000 $(find tests -name *.spec.js)"},"author":{"name":"William Gozali","email":"will.gozali@gmail.com"},"license":"MIT","devDependencies":{"chai":"^3.5.0","lodash":"^4.14.2","mocha":"^3.0.2","rewire":"^2.5.2"},"gitHead":"953a11ede85bfa3baebe27d63dab5cc0bc2e6b31","_id":"pdfast@0.0.4","_shasum":"10d5a08d0814bf2c0266ca9b29c0d4876bb63175","_from":".","_npmVersion":"3.7.1","_nodeVersion":"4.2.2","_npmUser":{"name":"gyosh","email":"will.gozali@gmail.com"},"dist":{"shasum":"10d5a08d0814bf2c0266ca9b29c0d4876bb63175","size":4419,"noattachment":false,"key":"/pdfast/-/pdfast-0.0.4.tgz","tarball":"http://registry.cnpm.dingdandao.com/pdfast/download/pdfast-0.0.4.tgz"},"maintainers":[{"name":"gyosh","email":""}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/pdfast-0.0.4.tgz_1471054745438_0.8304294645786285"},"directories":{},"publish_time":1471054745674,"_hasShrinkwrap":false,"_cnpm_publish_time":1471054745674,"_cnpmcore_publish_time":"2021-12-16T16:43:09.876Z"},"0.0.3":{"name":"pdfast","version":"0.0.3","description":"Fast kernel density estimation library","main":"src/index.js","keywords":["pdf","probabilty","density","function","estimation","kernel"],"repository":{"type":"git","url":"git+https://github.com/gyosh/pdfast.git"},"bugs":{"url":"https://github.com/gyosh/pdfast"},"homepage":"https://github.com/gyosh/pdfast","scripts":{"test":"mocha --timeout 10000 $(find tests -name *.spec.js)"},"author":{"name":"William Gozali","email":"will.gozali@gmail.com"},"license":"MIT","devDependencies":{"chai":"^3.5.0","lodash":"^4.14.2","mocha":"^3.0.2","rewire":"^2.5.2"},"gitHead":"1ae03dbbac464271f3b3f3d6bb55f7130af9fa7e","_id":"pdfast@0.0.3","_shasum":"bc8bc95faeb8cb5130cff97d35e2d53e68570355","_from":".","_npmVersion":"3.7.1","_nodeVersion":"4.2.2","_npmUser":{"name":"gyosh","email":"will.gozali@gmail.com"},"dist":{"shasum":"bc8bc95faeb8cb5130cff97d35e2d53e68570355","size":13176,"noattachment":false,"key":"/pdfast/-/pdfast-0.0.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/pdfast/download/pdfast-0.0.3.tgz"},"maintainers":[{"name":"gyosh","email":""}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/pdfast-0.0.3.tgz_1470938363008_0.13554891292005777"},"directories":{},"publish_time":1470938365661,"_hasShrinkwrap":false,"_cnpm_publish_time":1470938365661,"_cnpmcore_publish_time":"2021-12-16T16:43:10.067Z"},"0.0.2":{"name":"pdfast","version":"0.0.2","description":"Fast kernel density estimation library","main":"src/index.js","keywords":["pdf","probabilty","density","function","estimation","kernel"],"repository":{"type":"git","url":"git+https://github.com/gyosh/pdfast.git"},"bugs":{"url":"https://github.com/gyosh/pdfast"},"homepage":"https://github.com/gyosh/pdfast","scripts":{"test":"mocha --timeout 10000 $(find tests -name *.spec.js)"},"author":{"name":"William Gozali","email":"will.gozali@gmail.com"},"license":"MIT","devDependencies":{"chai":"^3.5.0","lodash":"^4.14.2","mocha":"^3.0.2","rewire":"^2.5.2"},"gitHead":"9627dad89d61cb868ee67fbee901232e683b7b57","_id":"pdfast@0.0.2","_shasum":"f5428e767c4108c2b11da15e5864e6c6cd383318","_from":".","_npmVersion":"3.7.1","_nodeVersion":"4.2.2","_npmUser":{"name":"gyosh","email":"will.gozali@gmail.com"},"dist":{"shasum":"f5428e767c4108c2b11da15e5864e6c6cd383318","size":13204,"noattachment":false,"key":"/pdfast/-/pdfast-0.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/pdfast/download/pdfast-0.0.2.tgz"},"maintainers":[{"name":"gyosh","email":""}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/pdfast-0.0.2.tgz_1470938211558_0.8392631823662668"},"directories":{},"publish_time":1470938213796,"_hasShrinkwrap":false,"_cnpm_publish_time":1470938213796,"_cnpmcore_publish_time":"2021-12-16T16:43:10.737Z"},"0.0.1":{"name":"pdfast","version":"0.0.1","description":"Fast kernel density estimation library","main":"index.js","keywords":["pdf","probabilty","density","function","estimation","kernel"],"scripts":{"test":"mocha --timeout 10000 $(find tests -name *.spec.js)"},"author":{"name":"William Gozali","email":"will.gozali@gmail.com"},"license":"MIT","devDependencies":{"chai":"^3.5.0","lodash":"^4.14.2","mocha":"^3.0.2","rewire":"^2.5.2"},"gitHead":"c362a0e9b72c7186f8fae5424ff88231e404cb32","_id":"pdfast@0.0.1","_shasum":"f77d75fe1268cb789b462e624f74e931cbc0f6de","_from":".","_npmVersion":"3.7.1","_nodeVersion":"4.2.2","_npmUser":{"name":"gyosh","email":"will.gozali@gmail.com"},"dist":{"shasum":"f77d75fe1268cb789b462e624f74e931cbc0f6de","size":13087,"noattachment":false,"key":"/pdfast/-/pdfast-0.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/pdfast/download/pdfast-0.0.1.tgz"},"maintainers":[{"name":"gyosh","email":""}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/pdfast-0.0.1.tgz_1470936404911_0.8894047704525292"},"directories":{},"publish_time":1470936407207,"_hasShrinkwrap":false,"_cnpm_publish_time":1470936407207,"_cnpmcore_publish_time":"2021-12-16T16:43:10.980Z"}},"readme":"[![Build Status](https://travis-ci.org/gyosh/pdfast.svg)](https://travis-ci.org/gyosh/pdfast)\n[![npm version](https://badge.fury.io/js/pdfast.svg)](https://badge.fury.io/js/pdfast)\n\n# About\n\nKernel Density Estimation, generating probability density function (pdf) using triangular kernel, optimized to run in O(N + K).\n\nWhere:\n\n  * N: number of elements in the sample.\n  * K: number of points to represent the pdf.\n\n# API\n\n## create(arr, options)\n\nCreate pdf with given array and options.\n\nOptions:\n\n  * `min`: min value for the pdf's x range. If resulting pdf won't fit, the pdf's left part will be squeezed, as [described here](http://stats.stackexchange.com/questions/65866/good-methods-for-density-plots-of-non-negative-variables-in-r). Defaults to smallest value in the array minus some threshold.\n  * `max`: max value for the pdf's x range. If resulting pdf won't fit, the pdf's right will be squeezed. Defaults to largest value in the array plus some threshold.\n  * `size`: number of points to represent the pdf. Defaults to 50.\n  * `width`: determine how many points to the left and right does an element affect, similar to *bandwidth* in kernel density estimation. Defaults to 2.\n\n```js\nvar arr = [1, 2, 3, 3, 4, 5, 5, 5, 6, 8, 9, 9];\nvar options = {\n  min: 0,\n  max: 10,\n  size: 12,\n  width: 2\n};\n\nvar pdf = pdfast.create(arr, options);\n```\n\n`pdf`'s value:\n```\n[ { x: 0, y: 0.020833333333333332 },\n  { x: 0.9090909090909091, y: 0.0625 },\n  { x: 1.8181818181818181, y: 0.10416666666666667 },\n  { x: 2.727272727272727, y: 0.125 },\n  { x: 3.6363636363636362, y: 0.14583333333333334 },\n  { x: 4.545454545454545, y: 0.16666666666666666 },\n  { x: 5.454545454545454, y: 0.10416666666666667 },\n  { x: 6.363636363636363, y: 0.041666666666666664 },\n  { x: 7.2727272727272725, y: 0.08333333333333333 },\n  { x: 8.181818181818182, y: 0.10416666666666667 },\n  { x: 9.09090909090909, y: 0.041666666666666664 },\n  { x: 10, y: 0 } ]\n```\n\n## getExpectedValueFromPdf(pdf)\n\n```js\nexpect(\n  pdfast.getExpectedValueFromPdf([\n    {x: 1, y: 0.2},\n    {x: 2, y: 0.3},\n    {x: 3, y: 0.3},\n    {x: 4, y: 0.2},\n    {x: 5, y: 0.0}\n  ])\n).closeTo(2.5, 1e-8);\n```\n\n## getXWithLeftTailArea(pdf, area)\n\n```js\nvar pdf = [\n  {x: 1, y: 0.2},\n  {x: 2, y: 0.4},\n  {x: 3, y: 0.3},\n  {x: 4, y: 0.075},\n  {x: 5, y: 0.025}\n];\n\nexpect(pdfast.getXWithLeftTailArea(pdf, 0)).equal(1);\nexpect(pdfast.getXWithLeftTailArea(pdf, 0.12)).equal(1);\nexpect(pdfast.getXWithLeftTailArea(pdf, 0.19)).equal(1);\nexpect(pdfast.getXWithLeftTailArea(pdf, 0.21)).equal(2);\nexpect(pdfast.getXWithLeftTailArea(pdf, 0.95)).equal(4);\nexpect(pdfast.getXWithLeftTailArea(pdf, 1)).equal(5);\n```\n\n## getPerplexity(pdf)\n\n```js\nexpect(\n  pdfast.getPerplexity([\n    {x: 1, y: 0.2},\n    {x: 2, y: 0.4},\n    {x: 3, y: 0.3},\n    {x: 4, y: 0.075},\n    {x: 5, y: 0.025}\n  ])\n).closeTo(3.8041316039860336, EPS);\n```\n\n## getUnifiedMinMax(arr, options)\n\nTakes the same options as `create`. Returns an object with key `min` and `max`.\n\nIf you left `min` or `max` or both to be non number, it will be filled with number which will fit the data distribution.\n\n## getUnifiedMinMaxMulti([arr1, arr2, ...], options)\n\nSimilar with `getUnifiedMinMax`, but takes list of arrays. The generated `min` and/or `max` will fit all the arrays' distribution.\n\nUseful when trying to generate pdf for multiple labelled data and want to display them in the same chart. With same `min` and `max`, one can combine the pdf correctly.\n\n# License\nMIT\n","_attachments":{},"homepage":"https://github.com/gyosh/pdfast","bugs":{"url":"https://github.com/gyosh/pdfast"},"license":"MIT"}