Beispiel #1
0
        public static void CalculateCorr(List <RowType> rows)
        {
            var zcm      = ZeroCrossing.ProcessRows(rows);
            var tat      = TimeAboveThreshold.ProcessRows(rows);
            var integral = Integral.ProcessRows(rows);
            var ai       = ActivityIndex.ProcessRows(rows);

            double corrZcmTat = MathNet.Numerics.Statistics.Correlation.Pearson(zcm.Select(m => m.Activity), tat.Select(m => m.Activity));
            double corrZcmInt = MathNet.Numerics.Statistics.Correlation.Pearson(zcm.Select(m => m.Activity), integral.Select(m => m.Activity));
            double corrZcmAi  = MathNet.Numerics.Statistics.Correlation.Pearson(zcm.Select(m => m.Activity), ai.Select(m => m.Activity));

            Console.WriteLine("ZCM => TAT: " + corrZcmTat);
            Console.WriteLine("ZCM => Int: " + corrZcmInt);
            Console.WriteLine("ZCM => AI: " + corrZcmAi);


            double corrTatZcm = MathNet.Numerics.Statistics.Correlation.Pearson(tat.Select(m => m.Activity), zcm.Select(m => m.Activity));
            double corrTatInt = MathNet.Numerics.Statistics.Correlation.Pearson(tat.Select(m => m.Activity), integral.Select(m => m.Activity));
            double corrTatAi  = MathNet.Numerics.Statistics.Correlation.Pearson(tat.Select(m => m.Activity), ai.Select(m => m.Activity));

            Console.WriteLine("TAT => ZCM: " + corrTatZcm);
            Console.WriteLine("TAT => Int: " + corrTatInt);
            Console.WriteLine("TAT => AI: " + corrTatAi);


            double corrIntZcm = MathNet.Numerics.Statistics.Correlation.Pearson(integral.Select(m => m.Activity), zcm.Select(m => m.Activity));
            double corrIntTat = MathNet.Numerics.Statistics.Correlation.Pearson(integral.Select(m => m.Activity), tat.Select(m => m.Activity));
            double corrIntAi  = MathNet.Numerics.Statistics.Correlation.Pearson(integral.Select(m => m.Activity), ai.Select(m => m.Activity));

            Console.WriteLine("Int => ZCM: " + corrIntZcm);
            Console.WriteLine("Int => TAT: " + corrIntTat);
            Console.WriteLine("Int => AI: " + corrIntAi);

            double corrAiZcm = MathNet.Numerics.Statistics.Correlation.Pearson(ai.Select(m => m.Activity), zcm.Select(m => m.Activity));
            double corrAiTat = MathNet.Numerics.Statistics.Correlation.Pearson(ai.Select(m => m.Activity), tat.Select(m => m.Activity));
            double corrAiInt = MathNet.Numerics.Statistics.Correlation.Pearson(ai.Select(m => m.Activity), integral.Select(m => m.Activity));

            Console.WriteLine("AI => ZCM: " + corrAiZcm);
            Console.WriteLine("AI => TAT: " + corrAiTat);
            Console.WriteLine("AI => Int: " + corrAiInt);
        }
        public static List <ActivityPerMinute> BeginAnalyzation(AcceptableActivityOptions option,
                                                                List <RowType> rows)
        {
            List <ActivityPerMinute> analyzedActivities;

            switch (option)
            {
            case AcceptableActivityOptions.EnergyExpenditure:
                analyzedActivities = EnergyExpenditure.ProcessRows(rows);
                break;

            case AcceptableActivityOptions.ZeroCrossing:
                analyzedActivities = ZeroCrossing.ProcessRows(rows);
                break;

            case AcceptableActivityOptions.ActivityIndex:
                analyzedActivities = ActivityIndex.ProcessRows(rows);
                break;

            case AcceptableActivityOptions.TAT:
                analyzedActivities = TimeAboveThreshold.ProcessRows(rows);
                break;

            case AcceptableActivityOptions.Int:
                analyzedActivities = Integral.ProcessRows(rows);
                break;

            case AcceptableActivityOptions.Corr:
                Correlation.CalculateCorr(rows);
                analyzedActivities = Integral.ProcessRows(rows);     // Needed.
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(option), option, null);
            }

            NormalizeActivities(analyzedActivities);
            return(analyzedActivities);
        }