jasondavies / science.js Goto Github PK
View Code? Open in Web Editor NEWScientific and statistical computing in JavaScript.
Home Page: http://www.jasondavies.com/
License: Other
Scientific and statistical computing in JavaScript.
Home Page: http://www.jasondavies.com/
License: Other
The loess example is broken. It tries to call d3.chart.scatter() which seems to be removed from d3.
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!
I noticed a few issues with cluster distances when calling hcluster
with a complete
or average
linkage. For more details, as well as a fix see this PR on a repo with hcluster
code derived from this repo.
Related Pull Request: jdfekete/reorder.js#48
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?
It'd be easier to experiment with science.js if there's a shell or IDE. Python has IPython and R has R Studio. Maybe, an app written in mean.io.
Greetings,
It seems this repository is not maintained any longer.
It also seems that this fork by @sgratzl is the most active one https://github.com/sgratzl/science.js
It's published as @sgratzl/science
on NPM.
Is there any community consensus around this being the de-facto active fork? Thanks!
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.
Adding the test:
assert.equal(science.stats.mode([1, 1]), 1);
Throws that science.stats.mode
returns undefined
, when it should return 1.
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.
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.
I plan on using science.js in my course and it would make me happy to send the students to a release. It looks like you're already versioning science.js, so perhaps you'd be up for putting a zip file under "downloads"?
Would be lovely to see the methods in here documented.
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.
It's useful for D3 force layout where we want to see nodes in groups. I've used Clauset-Newman-Moore clustering algorithm in NodeXL. They have decent result.
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.
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.
The code sets the linkage to "simple" when the switch only test for "single", "complete", and "average".
It should be "single".
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.