public void Sample_CorrectSelectClass(double feature1, double feature2, int classKey)
        {
            _randomSubstitute.Configure().NextDouble().Returns(feature1, feature2);
            var sample = new RandomGeneratedSample(_randomSubstitute);

            //check classes was not changed
            var satisfiedClass = _classes.First(c => c.ClassKey == classKey);

            satisfiedClass.IsValueSatisfied(sample).Should().BeTrue();

            sample.SetSatisfiedClass(_classes);
            sample.ClassKey.Should().Be(classKey);
        }
Beispiel #2
0
        public List <RandomGeneratedSample> GenerateSamples()
        {
            var uniqueSamplesDict = new Dictionary <(double, double), RandomGeneratedSample>();

            for (int i = 0; i < _samplesCount;)
            {
                var sample = new RandomGeneratedSample(_random);
                sample.SetSatisfiedClass(_classes);
                if (uniqueSamplesDict.ContainsKey((sample.Feature1, sample.Feature2)))
                {
                    continue;
                }

                uniqueSamplesDict.Add((sample.Feature1, sample.Feature2), sample);
                i++;
            }

            return(uniqueSamplesDict.Values.ToList());
        }