Exemple #1
0
        public void QuantileEstimator_DoubleDuplicationTest()
        {
            double first   = 1;
            double second  = 2;
            double between = (first + second) / 2;
            double next    = MMath.NextDouble(second);

            double[] x = { first, first, second, second };
            // quantiles are 0, 1/3, 2/3, 1
            var outer = new OuterQuantiles(x);

            Assert.Equal(0.0, outer.GetProbLessThan(first));
            Assert.Equal(first, outer.GetQuantile(0.0));
            Assert.Equal(0.5, outer.GetProbLessThan(between));
            Assert.Equal(between, outer.GetQuantile(0.5));
            Assert.Equal(2.0 / 3, outer.GetProbLessThan(second));
            Assert.Equal(second, outer.GetQuantile(2.0 / 3));
            Assert.Equal(1.0, outer.GetProbLessThan(next));
            Assert.Equal(next, outer.GetQuantile(1.0));
            CheckGetQuantile(outer, outer);
            var inner = InnerQuantiles.FromDistribution(5, outer);

            CheckGetQuantile(inner, inner, (int)Math.Ceiling(100.0 / 6), (int)Math.Floor(100.0 * 5 / 6));
            var est = new QuantileEstimator(0.01);

            est.Add(first, 2);
            est.Add(second, 2);
            Assert.Equal(0.0, est.GetProbLessThan(first));
            Assert.Equal(first, est.GetQuantile(0.0));
            Assert.Equal(0.5, est.GetProbLessThan(between));
            Assert.Equal(second, est.GetQuantile(2.0 / 3));
            Assert.Equal(1.0, est.GetProbLessThan(next));
            Assert.Equal(next, est.GetQuantile(1.0));
            CheckGetQuantile(est, est);
        }
Exemple #2
0
        public void QuantileEstimator_DoubleDuplicationTest2()
        {
            var data = new double[]
            {
                0.16659357378138889, // 0
                0.70210023978217528, // 0.25
                0.70210023978217528, // 0.5
                0.70319732172768734, // 0.75
                0.70319732172768734  // 1
            };
            var est = new QuantileEstimator(0.01);

            est.AddRange(data);
            Assert.Equal(data[4], est.GetQuantile(0.76));
            Assert.Equal(data[2], est.GetQuantile(0.3));
            CheckGetQuantile(est, est);
            var outer = new OuterQuantiles(data);

            Assert.Equal(data[4], outer.GetQuantile(0.76));
            Assert.Equal(data[2], outer.GetQuantile(0.3));
            CheckGetQuantile(outer, outer);
            var inner = InnerQuantiles.FromDistribution(7, outer);

            CheckGetQuantile(inner, inner, (int)Math.Ceiling(100.0 / 8), (int)Math.Floor(100.0 * 7 / 8));
        }
        public void QuantileEstimator_DuplicationTest()
        {
            double middle = 3.4;

            double[] x     = { 1.2, middle, middle, middle, 5.6 };
            var      outer = new OuterQuantiles(x);

            Assert.Equal(0.25, outer.GetProbLessThan(middle));
            Assert.Equal(outer.GetQuantile(0.3), middle);
            Assert.Equal(outer.GetQuantile(0.5), middle);
            Assert.Equal(outer.GetQuantile(0.7), middle);
            CheckGetQuantile(outer, outer);
            var inner = new InnerQuantiles(7, outer);

            Assert.Equal(0.25, inner.GetProbLessThan(middle));
            Assert.Equal(outer.GetQuantile(0.3), middle);
            Assert.Equal(outer.GetQuantile(0.5), middle);
            Assert.Equal(outer.GetQuantile(0.7), middle);
            CheckGetQuantile(inner, inner, 100 / 8, 100 * 7 / 8);
            var est = new QuantileEstimator(0.01);

            est.AddRange(x);
            Assert.Equal(0.25, est.GetProbLessThan(middle));
            Assert.Equal(est.GetQuantile(0.3), middle);
            Assert.Equal(est.GetQuantile(0.5), middle);
            Assert.Equal(est.GetQuantile(0.7), middle);
            CheckGetQuantile(est, est);
        }
Exemple #4
0
        public void QuantileEstimator_DuplicationTest()
        {
            double middle = 3.4;

            double[] x     = { 1.2, middle, middle, middle, 5.6 };
            var      outer = new OuterQuantiles(x);

            Assert.Equal(0.25, outer.GetProbLessThan(middle));
            Assert.Equal(outer.GetQuantile(0.3), middle);
            Assert.Equal(outer.GetQuantile(0.5), middle);
            Assert.Equal(outer.GetQuantile(0.7), middle);
            CheckGetQuantile(outer, outer);
            var inner = InnerQuantiles.FromDistribution(7, outer);

            Assert.Equal(0.25, inner.GetProbLessThan(middle));
            Assert.Equal(outer.GetQuantile(0.3), middle);
            Assert.Equal(outer.GetQuantile(0.5), middle);
            Assert.Equal(outer.GetQuantile(0.7), middle);
            CheckGetQuantile(inner, inner, (int)Math.Ceiling(100.0 / 8), (int)Math.Floor(100.0 * 7 / 8));
            var est = new QuantileEstimator(0.01);

            est.AddRange(x);
            Assert.Equal(est.GetQuantile(0.3), middle);
            Assert.Equal(est.GetQuantile(0.5), middle);
            // InterpolationType==1 returns NextDouble(middle)
            Assert.Equal(est.GetQuantile(0.7), middle, 1e-15);
            CheckGetQuantile(est, est);
        }
Exemple #5
0
        public void InnerQuantileTest()
        {
            double[]       quantiles = { -2.3396737042130806, -2.1060851851919309, -1.8587796492436919, -1.7515040214502977, -1.6631549706936311, -1.5649421094540212, -1.4760970897199182, -1.4120516891795316, -1.3472276831887715, -1.2800915764085863, -1.2315546431485036, -1.1733035015194753, -1.1275506999997809, -1.0868191452824896, -1.0423720676050061, -1.0030087867587449, -0.96427545374863111, -0.917480799606264, -0.88868683894166878, -0.85040868414900372, -0.80942702953353063, -0.78299794937710787, -0.74791530550923879, -0.71057667829968463, -0.6764786230399974, -0.64937712088706545, -0.61647747819758114, -0.585418062478127, -0.55212155586237877, -0.52794712262708809, -0.49602391921870309, -0.4699661621821, -0.44707572988386468, -0.41779003649017038, -0.38751278424822111, -0.3659754249474671, -0.33671101603741, -0.30844051169056652, -0.28736460398884939, -0.26394181175383763, -0.2339421108026867, -0.20421395179821347, -0.17975005820876525, -0.15495505128166037, -0.12881080807789203, -0.10882854018038969, -0.080502768973386082, -0.054592779524389491, -0.030746556623353873, 0.0010699779508669754, 0.018476164506076323, 0.042997842018717161, 0.068170326454891988, 0.098939711480485845, 0.12364243085219064, 0.14897752107634207, 0.17232065117344095, 0.19510514320430472, 0.21967681963331126, 0.25144866739098226, 0.26627058021030359, 0.28976112810281413, 0.325183138022793, 0.34611510490686043, 0.37135045464414679, 0.40484250840269187, 0.423660564514518, 0.45260008550109493, 0.47897070643517381, 0.513466904702678, 0.54074552445523427, 0.56782579073247685, 0.59191546380311844, 0.630594130276651, 0.66170186000470765, 0.69059427870805967, 0.72267836185626344, 0.75388989983592025, 0.78095231060517345, 0.81945443104186122, 0.85806474163877222, 0.88543000730858912, 0.9254742516670329, 0.96663287584250224, 1.0081099518226813, 1.0414716524617549, 1.0873521052324735, 1.138068925150572, 1.1769604530537776, 1.2209510765755074, 1.2805602443304192, 1.3529085306332467, 1.4111760504339896, 1.4822842454846386, 1.5518312997748602, 1.6439254270476189, 1.7357210363862619, 1.9281504259252962, 2.064331420559117, 2.3554568165928291, };
            InnerQuantiles inner     = new InnerQuantiles(quantiles);

            inner.GetQuantile(0.49471653842100138);
        }
Exemple #6
0
        public void InnerQuantiles_GetProbLessThan_IsIncreasing()
        {
            var quantiles      = new double[] { -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.166666666666667, -7.0149625935162021, -6.741895261845384, -6.4688279301745659, -6.1957605985037265, -5.9226932668329084, -5.64962593516209, -5.3765586034912722, -5.1034912718204541, -4.8304239401496138, -4.5573566084787958, -4.2842892768079777, -4.01122194513716, -3.738154613466341, -3.4650872817955016, -3.1920199501246835, -2.9189526184538654, -2.6458852867830256, -2.3728179551122075, -2.0997506234413894, -1.8266832917705711, -1.553615960099753, -1.2805486284289136, -1.0074812967580955, -0.7344139650872773, -0.46134663341645915, -0.18827930174564103, 0.084788029925200167, 0.35785536159601822, 0.63092269326683625, 0.903990024937654, 1.1770573566084719, 1.4501246882793115, 1.7231920199501294, 1.996259351620969, 2.2693266832917867, 2.5423940149626052, 2.8154613466334251, 3.0885286783042427, 3.3615960099750803, 3.6346633416458989, 3.9077306733167165, 4.1807980049875351, 4.4538653366583523, 4.7269326683291935 };
            var innerQuantiles = new InnerQuantiles(quantiles);

            const double left      = -7.1666666666666679;
            const double right     = -7.166666666666667;
            double       probLeft  = innerQuantiles.GetProbLessThan(left);
            double       probRight = innerQuantiles.GetProbLessThan(right);

            Assert.True(left < right, "It is given that left < right");
            Assert.True(probLeft <= probRight, "CDF must be non-decreasing");
        }
Exemple #7
0
 public void InnerQuantiles_InfinityTest()
 {
     Assert.Throws <ArgumentOutOfRangeException>(() =>
     {
         var inner = new InnerQuantiles(new double[] { double.PositiveInfinity });
     });
     Assert.Throws <ArgumentOutOfRangeException>(() =>
     {
         var est = new QuantileEstimator(0.1);
         est.Add(double.PositiveInfinity);
         //est.Add(double.NegativeInfinity);
         var inner = InnerQuantiles.FromDistribution(10, est);
     });
 }
Exemple #8
0
        public void QuantileEstimator_SinglePointIsMedian()
        {
            QuantileEstimator est   = new QuantileEstimator(0.1);
            double            point = 2;

            est.Add(point);
            Assert.Equal(point, est.GetQuantile(0.5));

            OuterQuantiles outer = new OuterQuantiles(new[] { point });

            Assert.Equal(point, outer.GetQuantile(0.5));

            InnerQuantiles inner = new InnerQuantiles(new[] { point });

            Assert.Equal(point, inner.GetQuantile(0.5));
        }
Exemple #9
0
        public void InnerQuantiles_GetQuantile_IsIncreasing()
        {
            var quantiles      = new double[] { 0, 4.94065645841247E-324, 4.94065645841247E-324, 4.0000000000000009 };
            var innerQuantiles = new InnerQuantiles(quantiles);

            int    n = 100;
            double previousQuantile = double.MinValue;

            for (int i = 0; i < n; i++)
            {
                double probability = (i + 1.0) / (n + 1);
                double quantile    = innerQuantiles.GetQuantile(probability);
                Assert.True(quantile >= previousQuantile);
                previousQuantile = quantile;
            }
        }
        public void QuantileEstimator_MedianTest()
        {
            double middle = 3.4;

            double[] x     = { 1.2, middle, 5.6 };
            var      outer = new OuterQuantiles(x);

            Assert.Equal(outer.GetQuantile(0.5), middle);
            var inner = new InnerQuantiles(3, outer);

            Assert.Equal(inner.GetQuantile(0.5), middle);
            var est = new QuantileEstimator(0.01);

            est.AddRange(x);
            Assert.Equal(est.GetQuantile(0.5), middle);
        }
Exemple #11
0
        public void QuantileTest()
        {
            // draw many samples from N(m,v)
            Rand.Restart(0);
            int           n      = 10000;
            double        m      = 2;
            double        stddev = 3;
            Gaussian      prior  = new Gaussian(m, stddev * stddev);
            List <double> x      = new List <double>();

            for (int i = 0; i < n; i++)
            {
                x.Add(prior.Sample());
            }
            x.Sort();
            var sortedData = new OuterQuantiles(x.ToArray());

            // compute quantiles
            var quantiles = InnerQuantiles.FromDistribution(100, sortedData);

            // loop over x's and compare true quantile rank
            var    testPoints = EpTests.linspace(MMath.Min(x) - stddev, MMath.Max(x) + stddev, 100);
            double maxError   = 0;

            foreach (var testPoint in testPoints)
            {
                var trueRank = MMath.NormalCdf((testPoint - m) / stddev);
                var estRank  = quantiles.GetProbLessThan(testPoint);
                var error    = System.Math.Abs(trueRank - estRank);
                //Trace.WriteLine($"{testPoint} trueRank={trueRank} estRank={estRank} error={error}");
                Assert.True(error < 0.02);
                maxError = System.Math.Max(maxError, error);

                double estQuantile = quantiles.GetQuantile(estRank);
                error = MMath.AbsDiff(estQuantile, testPoint, 1e-8);
                //Trace.WriteLine($"{testPoint} estRank={estRank} estQuantile={estQuantile} error={error}");
                Assert.True(error < 1e-8);

                estRank = sortedData.GetProbLessThan(testPoint);
                error   = System.Math.Abs(trueRank - estRank);
                //Trace.WriteLine($"{testPoint} trueRank={trueRank} estRank={estRank} error={error}");
                Assert.True(error < 0.02);
            }
            //Trace.WriteLine($"max rank error = {maxError}");
        }
Exemple #12
0
        public void QuantileEstimator_MedianTest()
        {
            double left   = 1.2;
            double middle = 3.4;
            double right  = 5.6;

            double[] x     = { left, middle, right };
            var      outer = new OuterQuantiles(x);

            Assert.Equal(middle, outer.GetQuantile(0.5));
            var inner = InnerQuantiles.FromDistribution(3, outer);

            Assert.Equal(middle, inner.GetQuantile(0.5));
            inner = new InnerQuantiles(x);
            CheckGetQuantile(inner, inner, 25, 75);
            var est = new QuantileEstimator(0.01);

            est.AddRange(x);
            Assert.Equal(est.GetQuantile(0.5), middle);
        }
Exemple #13
0
            public void Initialize(bool skipStringDistributions = false)
            {
                // DO NOT make this a constructor, because it makes the test not notice complete lack of serialization as an empty object is set up exactly as the thing
                // you are trying to deserialize.
                this.pareto  = new Pareto(1.2, 3.5);
                this.poisson = new Poisson(2.3);
                this.wishart = new Wishart(20, new PositiveDefiniteMatrix(new double[, ] {
                    { 22, 21 }, { 21, 23 }
                }));
                this.vectorGaussian = new VectorGaussian(Vector.FromArray(13, 14), new PositiveDefiniteMatrix(new double[, ] {
                    { 16, 15 }, { 15, 17 }
                }));
                this.unnormalizedDiscrete = UnnormalizedDiscrete.FromLogProbs(DenseVector.FromArray(5.1, 5.2, 5.3));
                this.pointMass            = PointMass <double> .Create(1.1);

                this.gaussian             = new Gaussian(11.0, 12.0);
                this.nonconjugateGaussian = new NonconjugateGaussian(1.2, 2.3, 3.4, 4.5);
                this.gamma              = new Gamma(9.0, 10.0);
                this.gammaPower         = new GammaPower(5.6, 2.8, 3.4);
                this.discrete           = new Discrete(6.0, 7.0, 8.0);
                this.conjugateDirichlet = new ConjugateDirichlet(1.2, 2.3, 3.4, 4.5);
                this.dirichlet          = new Dirichlet(3.0, 4.0, 5.0);
                this.beta      = new Beta(2.0, 1.0);
                this.binomial  = new Binomial(5, 0.8);
                this.bernoulli = new Bernoulli(0.6);

                this.sparseBernoulliList    = SparseBernoulliList.Constant(4, new Bernoulli(0.1));
                this.sparseBernoulliList[1] = new Bernoulli(0.9);
                this.sparseBernoulliList[3] = new Bernoulli(0.7);

                this.sparseBetaList    = SparseBetaList.Constant(5, new Beta(2.0, 2.0));
                this.sparseBetaList[0] = new Beta(3.0, 4.0);
                this.sparseBetaList[1] = new Beta(5.0, 6.0);

                this.sparseGaussianList    = SparseGaussianList.Constant(6, Gaussian.FromMeanAndPrecision(0.1, 0.2));
                this.sparseGaussianList[4] = Gaussian.FromMeanAndPrecision(0.3, 0.4);
                this.sparseGaussianList[5] = Gaussian.FromMeanAndPrecision(0.5, 0.6);

                this.sparseGammaList = SparseGammaList.Constant(1, Gamma.FromShapeAndRate(1.0, 2.0));

                this.truncatedGamma    = new TruncatedGamma(1.2, 2.3, 3.4, 4.5);
                this.truncatedGaussian = new TruncatedGaussian(1.2, 3.4, 5.6, 7.8);
                this.wrappedGaussian   = new WrappedGaussian(1.2, 2.3, 3.4);

                ga = Distribution <double> .Array(new[] { this.gaussian, this.gaussian });

                vga = Distribution <Vector> .Array(new[] { this.vectorGaussian, this.vectorGaussian });

                ga2D = Distribution <double> .Array(new[, ] {
                    { this.gaussian, this.gaussian }, { this.gaussian, this.gaussian }
                });

                vga2D = Distribution <Vector> .Array(new[, ] {
                    { this.vectorGaussian, this.vectorGaussian }, { this.vectorGaussian, this.vectorGaussian }
                });

                gaJ = Distribution <double> .Array(new[] { new[] { this.gaussian, this.gaussian }, new[] { this.gaussian, this.gaussian } });

                vgaJ = Distribution <Vector> .Array(new[] { new[] { this.vectorGaussian, this.vectorGaussian }, new[] { this.vectorGaussian, this.vectorGaussian } });

                var gp    = new GaussianProcess(new ConstantFunction(0), new SquaredExponential(0));
                var basis = Util.ArrayInit(2, i => Vector.FromArray(1.0 * i));

                this.sparseGp = new SparseGP(new SparseGPFixed(gp, basis));

                this.quantileEstimator = new QuantileEstimator(0.01);
                this.quantileEstimator.Add(5);
                this.outerQuantiles = OuterQuantiles.FromDistribution(3, this.quantileEstimator);
                this.innerQuantiles = InnerQuantiles.FromDistribution(3, this.outerQuantiles);

                if (!skipStringDistributions)
                {
                    // String distributions can not be serialized by some formatters (namely BinaryFormatter)
                    // That is fine because this combination is never used in practice
                    this.stringDistribution1 = StringDistribution.String("aa")
                                               .Append(StringDistribution.OneOf("b", "ccc")).Append("dddd");
                    this.stringDistribution2 = new StringDistribution();
                    this.stringDistribution2.SetToProduct(StringDistribution.OneOf("a", "b"),
                                                          StringDistribution.OneOf("b", "c"));
                }
            }