public void IncorrectBinCount()
 {
     Assert.That(() =>
     {
         var sgt = new SimpleGoodTuringProbabilityDistribution <string>(_fd, _fd.ObservedSamples.Count);
     }, Throws.TypeOf <ArgumentOutOfRangeException>());
 }
        public void NoSamples()
        {
            var sgt = new SimpleGoodTuringProbabilityDistribution <string>(new FrequencyDistribution <string>(), 1);

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

            Assert.That(sgt["a"], Is.EqualTo(0.01765).Within(0.00001));
            Assert.That(sgt["c"], Is.EqualTo(0.02728).Within(0.00001));
            Assert.That(sgt["d"], Is.EqualTo(0.03682).Within(0.00001));
            Assert.That(sgt["o"], Is.EqualTo(0.08433).Within(0.00001));
            Assert.That(sgt["q"], Is.EqualTo(0.1033).Within(0.0001));

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