Example #1
0
        private void Check([NotNull] double[] data, int minDistance, [NotNull] int[] expectedChangePoints)
        {
            var actualChangePoints = detector.GetChangePointIndexes(data, minDistance);

            output.WriteLine("EXPECTED : " + string.Join(", ", expectedChangePoints));
            output.WriteLine("ACTUAL   : " + string.Join(", ", actualChangePoints));
            output.WriteLine("");

            Assert.Equal(expectedChangePoints, actualChangePoints);
        }
        public static void Run(ChangePointDetectorOptions options)
        {
            PeltChangePointDetector detector = options.Algorithm switch
            {
                ChangePointDetectorAlgorithm.EdPelt => EdPeltChangePointDetector.Instance,
                ChangePointDetectorAlgorithm.RqqPelt => RqqPeltChangePointDetector.Instance,
                _ => throw new ArgumentOutOfRangeException(nameof(options.Algorithm))
            };

            var data = options.GetSourceArray();

            var indexes = detector.GetChangePointIndexes(data, options.MinDistance);

            Console.WriteLine(indexes.Any()
                ? string.Join(options.SourceSeparator, indexes)
                : "No changepoints found");
        }
    }