public String FindCorrelation(String category) { //if correlation is already logged in the dictionary, return it if (correlations.ContainsKey(category)) { return(correlations[category]); } else { //else search for it in the DLL MostCorrelatedFeature MostCorrelatedFeature = (MostCorrelatedFeature)Marshal.GetDelegateForFunctionPointer(pMostCorrelatedFeature, typeof(MostCorrelatedFeature)); StringBuilder tmp = new StringBuilder(); MostCorrelatedFeature(AnomalyDetector, regFlightPath, dataList.ToArray(), dataList.Count(), category, tmp); return(tmp.ToString()); } }
/*public void LineReg(String category, String correlatedCategory) * { * findLinReg findLinReg = (findLinReg)Marshal.GetDelegateForFunctionPointer(pFindLinReg, typeof(findLinReg)); * //findLinReg(TimeSeries, category, correlatedCategory); * }*/ public void CreateCorrelations() { MostCorrelatedFeature MostCorrelatedFeature = (MostCorrelatedFeature)Marshal.GetDelegateForFunctionPointer(pMostCorrelatedFeature, typeof(MostCorrelatedFeature)); StringBuilder tmp = new StringBuilder(); foreach (String category in dataList) { //finding the most correlated feature for each of the categories, according to the algorithm if (!correlations.ContainsKey(category)) { MostCorrelatedFeature(AnomalyDetector, regFlightPath, dataList.ToArray(), dataList.Count(), category, tmp); String tmpString = tmp.ToString(); if (!correlations.ContainsKey(category)) { correlations.Add(category, tmpString); //adding the anomaly time steps for the dictionary for this category so we can upload them at any time without calling for the DLL function //relevantTimeSteps.Add(category, GetAllTimestepsForeAnomalies(category, tmpString)); } } } }