First, ask yourself the maximum number of possible edges in the graph. This is when every vertex is connected to every single other vertex (nC2 = n * (n-1)/2), assuming this is an undirected graph without self-loops). If each possible edge has a likelihood of 0.004, and the # of...

bayesian,bayesian-networks,probability-theory

It's easiest to maintain the joint probability table, and rebuild the CPT from that as needed. Along with the JPT, keep a count of how many examples were used to produce it. When adding the nth example, multiply all probabilities by 1 - 1/n, and then add probability 1/n to...

You need something called Reservoir Sampling. It's explained pretty well in this blog: http://gregable.com/2007/10/reservoir-sampling.html...

algorithm,combinatorics,probability-theory

I have completely reviewed my response : **Bugs fixed** in : `array function computeRepettition(array $a);` **Avoid** increment of repetition if triad was already found in pass-1 **Return** an array of arrays, and the number of repetition of each triad is set in '**numberOfRepetition**', the triad in self is the key...

python,probability,probability-theory

So, if I'm understanding your comment correctly, what you are having trouble with is the concept of calculating the conditional probability when there are two or more "conditions" as opposed to a single condition. It's been quite a while since I last took a probability/statistics class, but I think what...

c#,matlab,matrix,statistics,probability-theory

This isn't an elegant solution or anything, but I think it can work... Why don't you create a covariance matrix by filling in the values, and then call ColumnCovariance() and RowCovariance() on it? I've never written C#, so I don't know the syntax but this should give you a general...

time-series,sampling,measurement,probability-theory

I'm going to approach this problem as if it were on a test. First, let's name the variables. Bx is value of the boolean variable after x opportunities to flip (and B0 is the initial state). P is the chance of changing to a different value every opportunity. Given that...

c,probability,normal-distribution,quantitative-finance,probability-theory

The standard normal cumulative distribution function is exactly (1/2)*(1 + erf(z/sqrt(2))) where erf is the Gaussian error function, which is found in many C programming libraries. Check the development environment you are using -- chances are good that erf is already in one of its libraries.

php,key,probability,probability-theory

Probability of a collision is very low in your case (though possible). Counting all possible values of image name: (9999999-1000000+1)^3 == 7.29 * 10^20. Hint: you may increase this value by generating numbers between 0 and 9999999 and left-padding them with zeros while converting to strings, e.g.: sprintf("%07d", $number) mt_rand...

java,r,probability,probability-theory

Is this what you are trying to do?? n <- 50 # number of rolls in a trial k <- 100000 # number if trials in the simulation x <- 220 # cutoff for calculating P(X<x) p <- c(1/10,1/10,1/10,1/10,3/10,3/10) # distribution of p-side X <- sapply(1:k,function(i)sum(sample(1:6,n,replace=T,prob=p))) P <- sum(X<x)/length(X) #...