Exemplo n.º 1
0
        public void test_ehler_transform_transformation()
        {
            Stack <ITransformation> transforms = null;

            Ehler ehler = new Ehler(
                ALPHA,
                AddForSineWave,
                AddForCycle,
                NUM_PREDICTION_DAYS,
                isRecursive,
                minLength,
                scoring,
                scoring);

            List <double> actual = ehler.Remove(TrendingSignal, ref transforms);

            var transformation = transforms.Pop();

            double[] retrended = new double[100];

            for (int i = 0; i < actual.Count; i += 1)
            {
                retrended[i] = actual[i] + transformation.ValueAt(i);
            }

            var rms = Math.Sqrt(TrendingSignal.Zip(retrended, (x, y) => Math.Pow((x - y), 2)).Average());

            Assert.IsTrue(rms <= TOLERANCE);
        }
Exemplo n.º 2
0
        public void test_ehler_transform_decycling()
        {
            Stack <ITransformation> transforms = null;

            Ehler ehler = new Ehler(
                ALPHA,
                AddForSineWave,
                AddForCycle,
                NUM_PREDICTION_DAYS,
                isRecursive,
                minLength,
                scoring,
                scoring);

            List <double> actual = ehler.Remove(TrendingSignal, ref transforms);

            var rms = Math.Sqrt(Trend.Zip(actual, (x, y) => Math.Pow((x - y), 2)).Average());

            Assert.IsTrue(rms <= TOLERANCE);
        }