public void MoveBackwardByMonthShouldCorret2()
        {
            // Arrange
            var generator         = new TimeSeriesGenerator();
            var targetDate        = new DateTime(2018, 01, 15);
            var count             = 12;
            var includeTargetDate = true;

            // Action
            var series = generator.MoveBackwardByMonth(targetDate, count, includeTargetDate);

            // Assertions
            var list = series.ToList();

            list.Count.Should().Be(count + 1);
            for (int i = 0; i < list.Count - 1; i += 2)
            {
                list[i].AddMonths(-1).Ticks.Should().Be(list[i + 1].Ticks);
            }
        }
Beispiel #2
0
        // TODO: rework code from using 1d and 3d methods to just one
        public static int Generate(GenerateOptions opts, ILogger logger, FileWriter writer)
        {
            //TODO: add checks of opts
            opts.OutFile      = opts.OutFile ?? DefaultParams.seriesPath;
            opts.OutTestsFile = opts.OutTestsFile ?? DefaultParams.testsPath;

            logger.LogInformation("Operation started...");

            logger.LogInformation("Generate time-series");
            var rnd      = new Random();
            int distance = rnd.Next(opts.DataCount / 10);

            var generator = new TimeSeriesGenerator(opts.Sigma, opts.R, opts.B);

            var sequence = generator.Generate(DefaultParams.Y0, opts.Step, DefaultParams.skipCount + opts.DataCount);

            sequence = sequence.Skip(DefaultParams.skipCount);

            var testSequence = generator.Generate(DefaultParams.Y0, opts.Step,
                                                  DefaultParams.skipCount + opts.DataCount + distance + opts.TestsCount);

            if (opts.Dimentions == 1)
            {
                Get1dSequence(opts, logger, writer, sequence, testSequence);
            }

            if (opts.Dimentions == 3)
            {
                Get3dSequence(opts, logger, writer, sequence, testSequence);
            }
            //TODO: add write to MongoDb
            logger.LogInformation("The distance between learning sequence and testing sequence = {distance}", distance);
            logger.LogInformation("Operation completed");
#if DEBUG
            Console.ReadLine();
#endif
            return(0);
        }