Beispiel #1
0
 public void IncorrectBinCount()
 {
     Assert.That(() =>
     {
         var ls = new LidstoneProbabilityDistribution <string>(_fd, 1, _fd.ObservedSamples.Count);
     }, Throws.TypeOf <ArgumentOutOfRangeException>());
 }
Beispiel #2
0
        public void NoSamples()
        {
            var ls = new LidstoneProbabilityDistribution <string>(new FrequencyDistribution <string>(), 1, 1);

            Assert.That(ls["a"], Is.EqualTo(0));
            Assert.That(ls["b"], Is.EqualTo(0));
            Assert.That(ls["c"], Is.EqualTo(0));
            Assert.That(ls.Discount, Is.EqualTo(0));
        }
Beispiel #3
0
        public void ProbabilityTwoUnseen()
        {
            var ls = new LidstoneProbabilityDistribution <string>(_fd, 1, _fd.ObservedSamples.Count + 2);

            Assert.That(ls["a"], Is.EqualTo(0.01869).Within(0.00001));
            Assert.That(ls["c"], Is.EqualTo(0.02803).Within(0.00001));
            Assert.That(ls["d"], Is.EqualTo(0.03738).Within(0.00001));
            Assert.That(ls["o"], Is.EqualTo(0.08411).Within(0.00001));
            Assert.That(ls["q"], Is.EqualTo(0.10280).Within(0.00001));

            Assert.That(ls["t"], Is.EqualTo(0.00934).Within(0.00001));
            Assert.That(ls["z"], Is.EqualTo(0.00934).Within(0.00001));
        }
Beispiel #4
0
        public void ProbabilityOneUnseen()
        {
            var ls = new LidstoneProbabilityDistribution <string>(_fd, 1, _fd.ObservedSamples.Count + 1);

            Assert.That(ls["a"], Is.EqualTo(0.01886).Within(0.00001));
            Assert.That(ls["c"], Is.EqualTo(0.02830).Within(0.00001));
            Assert.That(ls["d"], Is.EqualTo(0.03773).Within(0.00001));
            Assert.That(ls["o"], Is.EqualTo(0.08490).Within(0.00001));
            Assert.That(ls["q"], Is.EqualTo(0.10377).Within(0.00001));

            Assert.That(ls["t"], Is.EqualTo(0.00943).Within(0.00001));
            Assert.That(ls["z"], Is.EqualTo(0.00943).Within(0.00001));
        }