errcw / gaussian Goto Github PK
View Code? Open in Web Editor NEWA JavaScript model of the normal distribution
License: MIT License
A JavaScript model of the normal distribution
License: MIT License
Hi, I would like to ask: is this library still maintained?
Per @amidos2006, when given Mean=0.451 and Variance=Math.pow(0.209, 2) then PDF(0.5) >1 which is an invalid result.
The following usage example would help the user to (a) understand how 'distribution' object should be used, (b) how to sample the distribution, and (c) what is the typical purpose of ppf method:
var gaussian = require('gaussian');
var distribution = gaussian(mean, variance);
// Take a random sample
var sample = distribution.ppf(Math.random());
Sorry if I'm missing something obvious here. But when pulling the package from npm I find there is no custom rand function for Gaussian.random.
See here
Both npm and Github report version 1.2.0.
But on Github in gaussian.js
we have:
Gaussian.prototype.random = function(num, randFn = null){
let mean = this.mean;
let std = this.standardDeviation;
return Array(num).fill(0).map(() => {
return generateGaussian(mean,std, randFn)
})
};
And on npm we have
// Generate [num] random samples
Gaussian.prototype.random = function(num){
let mean = this.mean;
let std = this.standardDeviation;
return Array(num).fill(0).map(() => {
return generateGaussian(mean,std)
})
};
I noticed that add and sub are missing from 1.0.0. Any chance of getting a new version with those functions?
Hi all,
looks like there is a bug on : https://github.com/errcw/gaussian/blob/master/test/gaussian.js
line number : 56
we don't seems to get a correct result on below calculation
var d = gaussian(0, 1);
test.epsilonEqual(d.ppf(0.5), 0);
expected result wont be : 0 when the .ppf(0.5)
mean = 0
variance = 1
any idea ?
thanks
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.