//sends each x y pair to dev and returns the highest
        public float HighestDev(List <float> x, List <float> y, Line line)
        {
            float maxDev = 0;

            for (int i = 0; i < x.Count; i++)
            {
                Point p      = new Point(x[i], y[i]);
                float newDev = AnomalyUtils.Dev(p, line);
                if (newDev > maxDev)
                {
                    maxDev = newDev;
                }
            }
            return(maxDev);
        }
        private float FindThreshold(List <float> l1, List <float> l2, Line lin_reg)
        {
            float max  = 0;
            int   size = l1.Count;

            for (int i = 0; i < size; i++)
            {
                Point point    = new Point(l1[i], l2[i]);
                float distance = AnomalyUtils.Dev(point, lin_reg);
                if (distance > max)
                {
                    max = distance;
                }
            }
            return(max);
        }
        public List <AnomalyReport> detect(IDictionary <string, List <float> > table)
        {
            List <AnomalyReport> anomalyReport = new List <AnomalyReport>();

            foreach (CorrelatedFeatures correlatedFeature in cf)
            {
                for (int i = 0; i < table[correlatedFeature.Feature1].Count; i++)
                {
                    Point p = new Point(table[correlatedFeature.Feature1].ElementAt(i), table[correlatedFeature.Feature1].ElementAt(i));
                    if (AnomalyUtils.Dev(p, correlatedFeature.Lin_Reg) > correlatedFeature.Threshold)
                    {
                        anomalyReport.Add(new AnomalyReport(correlatedFeature.Feature1 + "-" + correlatedFeature.Feature2, i));
                    }
                }
            }
            return(anomalyReport);
        }