GithubHelp home page GithubHelp logo

jasondavies / science.js Goto Github PK

View Code? Open in Web Editor NEW
882.0 882.0 102.0 1.34 MB

Scientific and statistical computing in JavaScript.

Home Page: http://www.jasondavies.com/

License: Other

Makefile 2.35% JavaScript 97.65%

science.js's People

Contributors

bmount avatar dnnx avatar jasondavies avatar joearasin avatar kitmonisit avatar zjonsson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

science.js's Issues

loess example is broken

The loess example is broken. It tries to call d3.chart.scatter() which seems to be removed from d3.

Stata Lpoly: Can this be replicated in science.js?

Before diving in head-first, great if someone can give me an indication if I am likely to succeed in mirroring Stata's Lpoly function with Science.js.

//The Stata function:
lpoly yVar xVar [aweight=weight_example], at(xVar) bwidth(7) gen(outputVariable)  

lpoly performs a kernel-weighted local polynomial regression of yvar on xvar and displays a
graph of the smoothed values with (optional) confidence bands.

http://www.stata.com/manuals13/rlpoly.pdf

ps. I think my main concern is about the application of weights. In the example above I am using Stata's aweight ("Analytic weights"). Is there an equivalent of this in science.js?

Thank you!

Choice of license?

Hi,

I noticed that the license page says it is copywritted. The license reads:

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

  * Redistributions of source code must retain the above copyright notice, this
    list of conditions and the following disclaimer.

  * Redistributions in binary form must reproduce the above copyright notice,
    this list of conditions and the following disclaimer in the documentation
    and/or other materials provided with the distribution.

Does this mean that in all other packages that use this, they need to include that writing in their license?

There are, as listed on Gitbub, 50 other packages here that use it, and some quick skimming does not list this in the few I've looked at.

Maybe you would be willing to change to MIT or something standard?

Documentation needed for functions

I came in via a non R background and needed to use some variance, quantiles, and standard deviation functions for a project. Because of the lack of documentation, I looked for other libraries also and the only thing that made me stay was mike bostocks' recommendation.

I think if the documentation is improved with a) available functions b) a couple of samples, it could really help people like me quickly adopt this library.

p.s. I shall also try to edit the md file and issue a pull request with the docs.

Add an id to clusters created by hcluster

I think there is currently no way to relate the nodes/clusters created by the hcluster function to rows in the vector passed to the hcluster function once the clustering is computed.
Adding an attribute "id" or "index" to the clusters created would allow to link them back to their related vector indices.
It adds 3 lined to the code, initializing a variable id=0 and, e.g. line 59:
id: id++,
line 86:
id: id++,

leaf clusters would have an id < vectors.length, the others would be interior nodes.

Documentation

A guide would probably be better than a wiki; personally, I am trying to use loess.js for a project of mine, but some documentation beyond the included loess example would definitely help. :)

I’ve created a basic docco webpage for science.v1.js here as an alternative to the basic GitHub inspection.

#d3.js at freenode is really low on activity, but maybe I could try asking around to see which other parts of science.js people would like to see documentation/guides for.

Mode of single-element arrays is null

This seems incorrect:

assert.equal(science.stats.mode([1]), 1);

Fails, since it's null. If this isn't desired behavior, I can probably pull together a patch to fix.

.stats.kde() doesn't like multiple repeated values

I'm not sure whether this is a limitation of JS, or whether it's a bug in science.js, but when I give kde a dataset with multiple repeating values, such as:

[394, 0, 393, 1271, 0, 640, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1159, 969, 2891, 9, 1425, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1071, 0, 592, 998, 1384, 0, 21, 1711, 341, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 141, 692, 0, 0, 0, 0, 0, 0, 0, 0, 651, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 901, 0, 0, 0, 0, 7, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 584, 0, 818, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

or

[68.93749237060547, 84.54015350341797, 127.1878890991211, 68.9375, 174.15017700195312, 68.9375, 68.9375, 68.9375, 68.9375, 68.9375, 68.9375, 68.9375, 68.9375, 68.9375, 68.9375, 68.9375, 68.9375, 68.9375, 147.9225311279297, 52.56502151489258, 203.442626953125, 83.44722747802734, 139.95753479003906, 68.9375, 68.9375, 68.9375, 68.9375, 68.9375, 68.9375, 68.9375, 68.93749237060547, 68.93749237060547, 68.93749237060547, 68.9375, 68.9375, 68.93749237060547, 68.93749237060547, 68.93749237060547, 68.93749237060547, 68.9375, 68.9375, 68.93749237060547, 68.93749237060547, 68.93749237060547, 68.9375, 68.93749237060547, 68.93749237060547, 68.9375, 68.9375, 68.9375, 68.9375, 68.9375, 68.93749237060547, 68.9375, 68.9375, 68.9375, 68.93749237060547, 68.9375, 68.9375, 68.9375, 68.9375, 68.9375, 68.9375, 68.9375, 160.83853149414062, 68.9375, 101.62258911132812, 112.3798828125, 124.74468231201172, 68.9375, 68.9375, 186.23104858398438, 129.73406982421875, 68.9375, 68.93749237060547, 68.9375, 68.9375, 68.9375, 68.9375, 68.9375, 68.9375, 68.9375, 68.9375, 68.93749237060547, 68.93749237060547, 68.93749237060547, 68.93749237060547, 74.37715911865234, 109.83863830566406, 68.93749237060547, 68.93749237060547, 68.93749237060547, 68.93749237060547, 68.93749237060547, 68.9375, 68.9375, 68.9375, 91.8897476196289, 68.9375, 68.9375, 68.9375, 68.9375, 68.9375, 68.9375, 68.9375, 68.9375, 68.9375, 68.9375, 68.9375, 68.9375, 68.9375, 119.34972381591797, 68.9375, 68.9375, 68.9375, 68.9375, 68.9375, 68.9375, 68.93749237060547, 68.93749237060547, 68.93749237060547, 68.93749237060547, 68.93749237060547, 68.93749237060547, 68.93749237060547, 68.93749237060547, 68.93749237060547, 68.93749237060547, 68.93749237060547, 68.93749237060547, 68.93749237060547, 68.93749237060547, 68.93749237060547, 68.93749237060547, 68.93749237060547, 68.93749237060547, 68.93749237060547, 68.93749237060547, 68.93749237060547, 68.93749237060547, 68.93749237060547, 68.93749237060547, 68.93749237060547, 68.93749237060547, 68.93749237060547, 68.93749237060547, 68.93749237060547, 68.93749237060547, 68.93749237060547, 68.93749237060547, 68.93749237060547, 68.93749237060547, 68.93749237060547, 68.93749237060547, 68.93749237060547, 68.93749237060547, 68.93749237060547, 68.93749237060547, 68.93749237060547, 68.93749237060547, 68.93749237060547, 68.93749237060547, 68.93749237060547, 68.93749237060547, 68.93749237060547, 68.93749237060547, 68.93749237060547, 57.34675216674805, 68.9375]

or

[1, 2, 3, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]

I either get NaNs or 0s when evaluating the probability at a point, or a probability of greater than 1.

Loess -- Returning NaNs.

I have run into an issue with loess where, for a set of points, all the weights are becoming 0, thus leaving NaN as the result for a piece of the fit. I'm going to try to put together a simple test case.

errors installing with npm 1.1.13 or newer

I'm getting errors using npm versions 1.1.13 or later installing science.js.

The error starts occurring after this commit in npm: isaacs/npm@ed2a3c1090aa4c7

[science.js-git (master)]$ npm -v
1.1.18

[science.js-git (master)]$ npm install . -g
npm ERR! error reading .
npm ERR! couldn't pack . to /var/folders/zK/zK+A4xtxHSevr7D+EoIsPE+++TQ/-Tmp-/npm-1334863687383/1334863687383-0.24840772151947021/tmp.tgz
npm ERR! Could not install: .

npm ERR! SyntaxError: Unexpected token }
npm ERR!     at Object.parse (native)
npm ERR!     at Packer.readRules (/usr/local/lib/node_modules/npm/node_modules/fstream-npm/fstream-npm.js:179:33)
npm ERR!     at Packer.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/fstream-npm/node_modules/fstream-ignore/ignore.js:132:22)
npm ERR!     at [object Object].<anonymous> (fs.js:123:5)
npm ERR!     at [object Object].emit (events.js:64:17)
npm ERR!     at fs.js:1181:12
npm ERR!     at Object.oncomplete (/usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:94:5)
npm ERR! You may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <[email protected]>
npm ERR! 
npm ERR! System Darwin 10.8.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "." "-g"
npm ERR! cwd /Users/stephen/dev/javascript/d3/science.js-git
npm ERR! node -v v0.6.15
npm ERR! npm -v 1.1.18
npm ERR! file /Users/stephen/dev/javascript/d3/science.js-git/lib/uglifyjs/package.json
npm ERR! path /Users/stephen/dev/javascript/d3/science.js-git/lib/uglifyjs
npm ERR! type unexpected_token
npm ERR! fstream_path /Users/stephen/dev/javascript/d3/science.js-git/lib/uglifyjs
npm ERR! fstream_type Directory
npm ERR! fstream_class Packer
npm ERR! arguments [ '}' ]
npm ERR! message Unexpected token }
npm ERR! fstream_stack Packer.readRules (/usr/local/lib/node_modules/npm/node_modules/fstream-npm/fstream-npm.js:182:10)
npm ERR! fstream_stack Packer.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/fstream-npm/node_modules/fstream-ignore/ignore.js:132:22)
npm ERR! fstream_stack [object Object].<anonymous> (fs.js:123:5)
npm ERR! fstream_stack [object Object].emit (events.js:64:17)
npm ERR! fstream_stack fs.js:1181:12
npm ERR! fstream_stack Object.oncomplete (/usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:94:5)

npm ERR! TypeError: Cannot call method 'filter' of undefined
npm ERR!     at Packer.addIgnoreRules (/usr/local/lib/node_modules/npm/node_modules/fstream-npm/node_modules/fstream-ignore/ignore.js:148:13)
npm ERR!     at Packer.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/fstream-npm/node_modules/fstream-ignore/ignore.js:133:10)
npm ERR!     at [object Object].<anonymous> (fs.js:123:5)
npm ERR!     at [object Object].emit (events.js:64:17)
npm ERR!     at fs.js:1181:12
npm ERR!     at Object.oncomplete (/usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:94:5)
npm ERR! You may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <[email protected]>
npm ERR! 
npm ERR! System Darwin 10.8.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "." "-g"
npm ERR! cwd /Users/stephen/dev/javascript/d3/science.js-git
npm ERR! node -v v0.6.15
npm ERR! npm -v 1.1.18
npm ERR! type non_object_property_call
npm ERR! arguments [ 'filter', undefined ]
npm ERR! message Cannot call method 'filter' of undefined
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /Users/stephen/dev/javascript/d3/science.js-git/npm-debug.log
npm not ok

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.