Sunday, November 27, 2016

We continue discussing the paper "Nested sampling  for general Bayesian computation" by Skilling
We were looking at the transformation of computing the evidence based on the prior mass instead of the parameters. We looked at the integration performed. This paper essentially says don't navigate the parameter space. It is sufficient to explore a likelihood weighted space
The method replaces the point of the lowest likelihood by new one drawn from within the likelihood
It increments the evidence by filling in the missing band with weight w = Xj/N  for each surviving point. The random values in the range 0,1 suffice.to draw the samples within the constrained likelihood contour. This method also calculates the information H during the iterations as a by product.
The method terminates when a certain number of iterations have been performed. This could be modified to stop when the largest current likelihood would not increase the current evidence by more than a small fraction f. This threshold implies that the accumulation of the evidence is tailing off and therefore the sum is nearly  complete.
The termination condition determines the total area found. The areas of the strips start by rising with the likelihood increasing faster than the widths decrease. This means more important regions are being found. When the likelihood flattens off, the areas pass across a maximum and start to fall away. Most of the total area is usually found in the region of this maximum with likelihood about e raised to the power -H.  If e were raised to the power -i/N, the method is set to continue  iterating "until the count i significantly exceeds NH".
#codingexercise

Find if two strings are interleaved in a third string
        static bool isInterleaved(String A, String B, String C)
        {
            int ia = 0;
            int ib = 0;
            for (int i = 0; i < C.Length; i++)
            {
                if (ia < A.Length && C[i] == A[ia])
                {
                    ia++;
                }
                else if (ib < B.Length && C[i] == B[ib])
                {
                    ib++;
                }
                else
                return false;
             
            }
            if (ia != A.Length || ib != B.Length)
                return false;
            return true;
        }

Print numbers vertically
void PrintVeritcally(int n)
{
var digits = n.ToDigits();
digits.ForEach (x => Console.WriteLine(x));
}
static List<int>ToDigits(this int n)
{
var ret = new List<int>();
while(n)
{
int k = i%10;
ret.Add(k);
n = n  / 10;
}
ret.reverse();
return ret;
}

No comments:

Post a Comment