Beispiel #1
0
 public override bool isAnomaly(Timeseries ts, correlatedFeatures cf, int timeStep)
 {
     if (cf.corrlation > circThreshold)
     {
         var   Column1   = ts.GetColumn(cf.feature1);
         var   Column2   = ts.GetColumn(cf.feature2);
         Point currPoint = new Point(Column1[timeStep], Column2[timeStep]);
         //Point point = cf.center
         return(Circle_Util.distanceBetweenPoints(currPoint, cf.center) > cf.threshold * 1.1);
     }
     return(false);
 }
Beispiel #2
0
 public override void addCorrelation(Timeseries ts, string feat1, string feat2, float pearson)
 {
     if (pearson > circThreshold)
     {
         correlatedFeatures correlation = new correlatedFeatures();
         correlation.feature1   = feat1;
         correlation.feature2   = feat2;
         correlation.corrlation = pearson;
         var    Column1   = ts.GetColumn(feat1);
         var    Column2   = ts.GetColumn(feat2);
         var    points    = Timeseries.CombineColumns(Column1, Column2);
         Circle welzlCirc = Circle_Util.welzl(points, new List <Point>());
         correlation.center    = welzlCirc.center;
         correlation.threshold = welzlCirc.radius;
         cf.Add(correlation);
     }
 }
Beispiel #3
0
    static public Circle welzl(List <Point> p, List <Point> r)
    {
        if (p.Count == 0 || r.Count == 3)
        {
            return(Circle_Util.findTrivialCircle(r, 3));
        }
        Point p0 = p[0];

        p.RemoveAt(0);
        Circle tmp = welzl(p, r);

        if (pointInCircle(p0, tmp))
        {
            return(tmp);
        }
        r.Add(p0);
        return(welzl(p, r));
    }