public static void WriteFinalResults(Evaluation eval, string fileName, Config _config, StringBuilder strBuilder) { //FA_1MIN_W_D_1_CM string fileStats = fileName + "\n"; fileName += "AdjParam-" + _config.AdjustmentParameter.ToString(); if (_config.CandidateSelectionCriteria == CandidateSelection.FEATURES_BASED_UNION) { fileName += "_Union"; fileStats += "Selecting Candidates independantly and then taking Union of Candidate DHGs\nFeature Set,"; } else if (_config.CandidateSelectionCriteria == CandidateSelection.HEARTBEAT) { fileName += "_Hratbeat"; fileStats += "Fusing Feature Set,"; } else if (_config.CandidateSelectionCriteria == CandidateSelection.SELECT_ALL) { fileName += "_SelectAll"; //fileStats += ","; } if (!(_config.CandidateSelectionCriteria == CandidateSelection.SELECT_ALL)) { if (_config.IsGF) { fileName += "-GF"; fileStats += "Growth Factor"; } if (_config.IsTP) { fileName += "-TP"; fileStats += ",Trend Probability"; } if (_config.IsDC) { fileName += "-AC"; fileStats += ",Aggregated Centrality\n"; } } fileStats += "Adjustment Parameter," + _config.AdjustmentParameter.ToString() + "\nTop-K," + _config.TopK.ToString() + "\n"; fileName += "_Rank"; fileStats += "Ranking,"; if (_config.IsDTFRanking) { fileName += "-DTF"; fileStats += "Disp. Temp. Freq."; } if (_config.IsDCRanking) { fileName += "-DC"; fileStats += "Degree Centrality"; } fileStats += "\n\n" + strBuilder + "\n\n"; var fileStream = new FileStream(fileName + ".csv", FileMode.Create, FileAccess.Write); var streamWriter = new StreamWriter(fileStream, Encoding.UTF8); string lineKPre = "K-Pre"; string lineKRec = "K-Rec"; string lineTPre = "T-Pre"; string lineTRec = "T-Rec"; string lineKF1 = "K-F1"; string lineTF1 = "T-F1"; string lineTRecResult = "T-Rec-Results,,"; string topTRec = "\n\n,,"; string top = ""; // FOR AT K = 2 topTRec += ",2"; lineTRecResult += "," + Math.Round(eval.TopicRecallAtK[1], 3).ToString(); for (int i = 0; i < _config.TopK; i++) { if ((i + 1) % 10 == 0) { topTRec += "," + (i + 1).ToString(); lineTRecResult += "," + Math.Round(eval.TopicRecallAtK[i], 3).ToString(); } top += "," + (i + 1).ToString(); lineKPre += "," + Math.Round(eval.KeywordPercisionAtK[i], 3).ToString(); lineKRec += "," + Math.Round(eval.KeywordRecallAtK[i], 3).ToString(); lineTPre += "," + Math.Round(eval.TopicPercisionAtK[i], 3).ToString(); lineTRec += "," + Math.Round(eval.TopicRecallAtK[i], 3).ToString(); lineKF1 += "," + Math.Round(eval.KeywordF1AtK[i], 3).ToString(); lineTF1 += "," + Math.Round(eval.TopicF1AtK[i], 3).ToString(); } streamWriter.WriteLine(fileStats); streamWriter.WriteLine(top); streamWriter.WriteLine(lineKPre); streamWriter.WriteLine(lineKRec); streamWriter.WriteLine(lineTPre); streamWriter.WriteLine(lineTRec); streamWriter.WriteLine(lineKF1); streamWriter.WriteLine(lineTF1); streamWriter.WriteLine(topTRec); streamWriter.WriteLine(lineTRecResult); streamWriter.Close(); }
public StringBuilder GenerateResults(ListDHGs lstDHG, GroundTruth groundTruth, SlidingWindows slidingWindow, Config _config) { FinalResult = new Evaluation(_config.TopK); return(DetectEventCandidates(lstDHG, groundTruth, slidingWindow, _config)); }