Esempio n. 1
0
        public Property DataPoints_Less_Than_K(PositiveInt unique)
        {
            var data = _dataGenerator.Generate((uint)unique.Get);

            return(Prop.Throws <InvalidOperationException, bool>(new Lazy <bool>(() =>
            {
                var result = _kMeans.Clusterize(data, (uint)unique.Get + 1);
                return true;
            })));
        }
Esempio n. 2
0
        public Property AllPointsUnique_WithZeroDupParameter(PositiveInt x)
        {
            var generator = new DataGenerator();
            var data      = generator.Generate((uint)x.Get);

            return(data
                   .All(x1 => !data.Any(x2 => x1.Features.SequenceEqual(x2.Features) && x1 != x2))
                   .ToProperty());
        }
Esempio n. 3
0
        public Property AllDuplicates_DifferentObjects(PositiveInt x, PositiveInt y)
        {
            var generator  = new DataGenerator();
            var data       = generator.Generate((uint)x.Get, (uint)y.Get);
            var duplicates = data.Skip(x.Get - 1).ToArray();

            return(duplicates
                   .All(x1 => duplicates.All(x2 => !Object.ReferenceEquals(x1, x2) || x1 == x2))
                   .ToProperty());
        }
Esempio n. 4
0
        public Property LastPointDuplicated_WithNotZeroDupParameter(PositiveInt x, PositiveInt y)
        {
            var generator  = new DataGenerator();
            var data       = generator.Generate((uint)x.Get, (uint)y.Get);
            var uniquePart = data.Take(x.Get).ToArray();
            var copyPart   = data.Skip(x.Get).ToArray();

            return(copyPart
                   .All(x1 => x1.Features.SequenceEqual(uniquePart.Last().Features))
                   .ToProperty());
        }