private void LearnHelper(IDictionary <string, List <float> > table, float maxCore, string f1, string f2) { CorrelatedFeatures cfs = new CorrelatedFeatures(); cfs.Feature1 = f1; cfs.Feature2 = f2; cfs.Corr = maxCore; cfs.Lin_Reg = AnomalyUtils.LinearReg(table[f1], table[f2]); cfs.Threshold = FindThreshold(table[f1], table[f2], cfs.Lin_Reg) * 1.1f; this.cf.Add(cfs); }
public void LearnNormal(IDictionary <string, List <float> > table) { int columnSize = table.ElementAt(0).Value.Count; //table.Keys.ElementAt(0) int rowSize = table.Count; for (int i = 0; i < table.Count; i++) { CorrelatedFeatures cfs = new CorrelatedFeatures(); cfs.Corr = -1; cfs.Feature1 = table.ElementAt(i).Key; for (int j = i + 1; j < table.Count; j++) { float correlation = AnomalyUtils.Pearson(table.ElementAt(i).Value, table.ElementAt(j).Value); if (correlation > correlationThreshold) { if (correlation > cfs.Corr) { cfs.Feature2 = table.ElementAt(j).Key; cfs.Corr = correlation; cfs.Lin_Reg = AnomalyUtils.LinearReg(table.ElementAt(i).Value, table.ElementAt(j).Value); cfs.Threshold = HighestDev(table.ElementAt(i).Value, table.ElementAt(j).Value, cfs.Lin_Reg); List <Point> pointsList = new List <Point>(); for (int k = 1; k < columnSize; k++) { pointsList.Add(new Point(table[cfs.Feature1].ElementAt(k), table[cfs.Feature2].ElementAt(k))); } cfs.CircleThreshold = MinCircle.FindMinCircle(pointsList); cfs.CircleThreshold.radius *= 1.1; } } } if (cfs.Corr > -1) { cf.Add(cfs); } } }
public Line CorrLinReg(string fName, string corrName) { this.linReg = AnomalyUtils.LinearReg(table[fName], table[corrName]); return(this.linReg); }