コード例 #1
0
        public void FitTest1()
        {
            EmpiricalDistribution target = new EmpiricalDistribution(new double[] { 0 });

            double[]        observations = { 1, 5, 2, 5, 1, 7, 1, 9, 4, 2 };
            double[]        weights      = null;
            IFittingOptions options      = null;

            target.Fit(observations, weights, options);
            Assert.AreEqual(1.8652004071576875, target.Smoothing);
            Assert.AreNotSame(observations, target.Samples);
            CollectionAssert.AreEqual(observations, target.Samples);
        }
コード例 #2
0
        public void FitTest2()
        {
            EmpiricalDistribution target = new EmpiricalDistribution(new double[] { 0 });

            double[]        observations = { 5, 5, 1, 4, 1, 2, 2, 3, 3, 3, 4, 3, 3, 3, 4, 3, 2, 3 };
            double[]        weights      = null;
            IFittingOptions options      = new EmpiricalOptions {
                SmoothingRule = FaultySmoothingRule
            };

            target.Fit(observations, weights, options);
            Assert.AreEqual(1.9144923416414432, target.Smoothing);
            Assert.AreNotSame(observations, target.Samples);
            CollectionAssert.AreEqual(observations, target.Samples);
        }
コード例 #3
0
        public void FitTest()
        {
            EmpiricalDistribution target = new EmpiricalDistribution(new double[] { 0 });

            double[]        observations = { 1, 5, 2, 5, 1, 7, 1, 9, 4, 2 };
            double[]        weights      = null;
            IFittingOptions options      = null;

            target.Fit(observations, weights, options);
            Assert.AreNotSame(observations, target.Samples);

            for (int i = 0; i < observations.Length; i++)
            {
                Assert.AreEqual(observations[i], target.Samples[i]);
            }
        }