I have a set of values which follows exponential distribution. Now, I want to calculate the rate parameter alpha. Can anybody help me how to calculate it (I am using c++ to code it)?
If you know these values are from an exponential distribution, then you can calculate the maximum likelihood of λ (lambda, not alpha) as the average of 1 / value for each of these values (because the mean of the exponential distribution is 1 / λ). this is a statistical calculation, since you are trying to assess a parameter through observation.
Related
In OpenCV I'm using cartToPolar function and I want to know the max possible value of calculated magnitude. Can it be greater than 255? I found something about calculation in the documentation about Hough Line Transform, but I still do not know the max value. I need this to calculate histograms, to devide the ranges for right buckets.
Best regards,
I'm using feed forward, gradient descent, backpropagation neural networks
where hidden/output neurons are using tanh activation function and input neurons are linear.
What is the best way, in your opinion, for normalizing numerical data if:
Maximum number is known and for example maximum positive number would be 1000 and maximum negative -1000.
Maximum number is unknown.
And if I should keep the maximum numbers same for all inputs or would it be okay
if network's inputs have different normalizing way?
Thanks!
If max and min are known, the easiest normalization is :
normalized = (val - min) / (max - min)
If max is unknown, you can normalize based on the data you do have, with the knowledge that tanh has good characteristics for values that exceed a magnitude of 1.
You should normalize different inputs based on the range of values of those inputs and you may use different normalization procedures for different inputs.
i have a sinusoidal-like shaped signal,and i would like to compute the frequency.
I tried to implement something but looks very difficult, any idea?
So far i have a vector with timestep and value, how can i get the frequency from this?
thank you
If the input signal is a perfect sinusoid, you can calculate the frequency using the time between positive 0 crossings. Find 2 consecutive instances where the signal goes from negative to positive and measure the time between, then invert this number to convert from period to frequency. Note this is only as accurate as your sample interval and it does not account for any potential aliasing.
You could try auto correlating the signal. An auto correlation can be rapidly calculated by following these steps:
Perform FFT of the audio.
Multiply each complex value with its complex conjugate.
Perform the inverse FFT of the audio.
The left most peak will always be the highest (as the signal always correlates best with itself). The second highest peak, however, can be used to calculate the sinusoid's frequency.
For example if the second peak occurs at an offset (lag) of 50 points and the sample rate is 16kHz and the window is 1 second then the end frequency is 16000 / 50 or 320Hz. You can even use interpolation to get a more accurate estimation of the peak position and thus a more accurate sinusoid frequency. This method is quite intense but is very good for estimating the frequency after significant amounts of noise have been added!
I'm estimating the parameters of a GMM using EM,
When I use my Matlab script And run the EM code i get a single value of "log-likelihood"..
However in opencv the output of EM.train gives a matrix which contained the loglikelihood value of every sample.
How do I get a single log likelihood value? Do I need to take the minimum of all the loglikelihood values of all samples or the sum of all loglikelihood values?
You need sum of log probabilities of datapoints which you use to estimate probability density function. You'll get loglikelihood of your estimation.
You can find good explanation in "Pattern Recognition and Machine Learning" book
I'm working with the random number generator available within C++11. At the moment, I'm using a uniform distribution, which should give me an equal probability to get any number within the range A & B which I specify.
However, I'm confused about generating Poisson distributions. While I understand how to determine the Poisson probability, I don't understand how a random series of numbers can be "distributed" based on the Poisson distribution.
For instance, the C++11 constructor for a Poisson distribution takes one argument -- λ, which is the mean of the distribution
std::tr1::poisson_distribution<double> poisson(7.0);
std::cout << poisson(eng) << std::endl;
In a Poisson probability problem, this is equal to the expected number of successes / occurrences during a given interval. However, I don't understand what it represents in this instance. What is a "success" / "occurrence" in a random number scenario?
I appreciate any assistance or reference materials which I can use to help me understand this.
The probability of a Poisson distribution is the chance a specific value occurs. Imagine you want to calculate how many cars pass a certain point each day. This value will be more some days, but less on other days. But when keeping track of this over a serious amount of time, a mean will start to emerge, with values in its vicinity occurring more often, and values further away (0 cars per day or a tenfold amount) being less likely. λ is that mean that emerged.
When reflecting this to RNG's, the algorithm would return you the amount of cars that passed on a random day (which is selected uniformly). As you can imagine the mean value λ is more likely to emerge, and the extremes are least likely to pop up.
The following link has an example of the distribution Poisson has, showing the discrete results you acquire, and the chance each of them has of occurring:
http://www.mathworks.com/help/toolbox/stats/brn2ivz-127.html
A sample implementation could calculate for each value the probability it occurs, and then calculate ranges based on these values to translate a uniform distribution to Poisson. e.g. for λ == 2 we have 13% chance for 0, 27% chance for 1, 27% chance for 2... Then we generate a good old uniform random number between 0.0 and 1.0. If this number is <= 0.13 return 0. Is it <= 0.40 return 1. Is it <= 0.67 return 2 etc...