public void WriteGeneralStat() { StringBuilder stat = new StringBuilder(); var notClassifiedCount = GetNotClassifiedCount(); var partialIncorrectCount = PartialMatch.Sum(t => t.InCorrectlyClassified.Count); var completeIncorrectCount = CompleteMatch.Sum(t => t.InCorrectlyClassified.Count); var totIncorrectCount = notClassifiedCount + partialIncorrectCount + completeIncorrectCount; var errorRate = Math.Round((float)totIncorrectCount / (float)TestData.Rows.Count, 4); stat.AppendLine("-----------------Mining Special Data Project-------------------"); stat.AppendLine("-- Name : Naresh Kumar Sampath -------------------"); stat.AppendLine("-- KUID : 2922935 -------------------"); stat.AppendLine("---------------------------------------------------------------"); stat.AppendLine(); stat.AppendLine("GENERAL STATISTICS"); stat.AppendFormat("This Report was created from: {0} and from: {1} \n", FileOperation.RuleFilePath, FileOperation.DataFilePath); stat.AppendFormat("The total number of cases: {0} \n", TestData.Rows.Count); stat.AppendFormat("The total number of attributes: {0} \n", TestData.Columns.Count - 2); stat.AppendFormat("The total number of rules: {0} \n", Rules.Rules.Count); stat.AppendFormat("The total number of conditions: {0} \n", Rules.Rules.Sum(t => t.Attributes.Count)); stat.AppendFormat("The total number of cases that are not classified: {0} \n", notClassifiedCount); stat.AppendLine("\t PARTIAL MATCHING:"); stat.AppendFormat(" The total number of cases that are incorrectly classified: {0} \n".PadLeft(4), partialIncorrectCount); stat.AppendFormat(" The total number of cases that are correctly classified: {0} \n".PadLeft(4), PartialMatch.Sum(t => t.CorrectlyClassified.Count)); stat.AppendLine("\t COMPLETE MATCHING:"); stat.AppendFormat(" The total number of cases that are incorrectly classified: {0} \n".PadLeft(4), completeIncorrectCount); stat.AppendFormat(" The total number of cases that are correctly classified: {0} \n", CompleteMatch.Sum(t => t.CorrectlyClassified.Count)); stat.AppendLine("\t PARTIAL AND COMPLETE MATCHING::"); stat.AppendFormat("The total number of cases that are not classified or incorrectly classified: {0} \n", totIncorrectCount); stat.AppendFormat("Error rate: {0} % ({1}) \n", errorRate * 100, errorRate); stat.AppendLine("------------------------------------------------------------"); Console.WriteLine(stat.ToString()); }
private int GetNotClassifiedCount() { return(TestData.Rows.Count - (PartialMatch.Sum(t => t.InCorrectlyClassified.Count) + PartialMatch.Sum(t => t.CorrectlyClassified.Count) + CompleteMatch.Sum(t => t.InCorrectlyClassified.Count) + CompleteMatch.Sum(t => t.CorrectlyClassified.Count))); }