Beispiel #1
0
        public void ExpandCurrentPopulation_OneNodeAndPopulationLengthOfTen_LengthTenPopulationWithExactValues()
        {
            var crf = new ChangeRatioFinder();

            var result = crf.GetMaximumChangeRatios(_trainingSet);

            var search     = new BeamLikeSearch();
            var population = new double[1][]
            {
                _node
            };

            var current = search.ExpandCurrentPopulation(population, 10, result.Down, result.Up);

            Assert.AreEqual(1406.22, Math.Round(current[0][3], 2));
            Assert.AreEqual(1410.76, Math.Round(current[1][3], 2));
            Assert.AreEqual(1415.31, Math.Round(current[2][3], 2));
            Assert.AreEqual(1419.85, Math.Round(current[3][3], 2));
            Assert.AreEqual(1424.40, Math.Round(current[4][3], 2));
            Assert.AreEqual(1428.94, Math.Round(current[5][3], 2));
            Assert.AreEqual(1433.49, Math.Round(current[6][3], 2));
            Assert.AreEqual(1438.04, Math.Round(current[7][3], 2));
            Assert.AreEqual(1442.58, Math.Round(current[8][3], 2));
            Assert.AreEqual(1447.13, Math.Round(current[9][3], 2));
        }
Beispiel #2
0
        public void Search_OneNodeAndKis3AndNis10_3Nodes()
        {
            var util   = new TestDataUtils();
            var crf    = new ChangeRatioFinder();
            var search = new BeamLikeSearch();

            var series     = util.GetSvcData(util.FTSEFilePath, new DateTime(2010, 12, 18), new DateTime(2011, 12, 18));
            var ratios     = crf.GetMaximumChangeRatios(series);
            var population = new double[1][]
            {
                series[series.Length]
            };
            var k = 3;
            var n = 10;
            var numberOfIterations = 10;

            var model = (HiddenMarkovModelMixtureDistribution)HiddenMarkovModelFactory.GetModel(new ModelCreationParameters <Mixture <IMultivariateDistribution> >()
            {
                NumberOfComponents = _NumberOfComponents, NumberOfStates = _NumberOfStates
            });

            model.Normalized = true;
            model.Train(series, _NumberOfIterations, _LikelihoodTolerance);


            var result = search.Search(population, k, n, numberOfIterations, ratios, model);

            Assert.IsNull(result);
        }
Beispiel #3
0
        public void ExpandCurrentPopulation_OneNodeAndPopulationLengthOfTen_LengthTenPopulation()
        {
            var crf = new ChangeRatioFinder();

            var result = crf.GetMaximumChangeRatios(_trainingSet);

            var search     = new BeamLikeSearch();
            var population = new double[1][]
            {
                _node
            };

            var current = search.ExpandCurrentPopulation(population, 10, result.Down, result.Up);

            Assert.AreEqual(10, current.Length);
        }