public int ClassifyTest(Dataset testData)
        {
            int NumExampleCorrect = 0;

            int[] example;
            for (int i = 0; i < testData.TrainingSet.Count; i++)
            {
                example = (int[])testData.getTrainingExample(i);
                List <Rule> RulesCanBeCalssifies = new List <Rule>();

                for (int j = 0; j < ListRules.Count; j++)
                {
                    bool b = isClassified(example, ListRules[j], testData);// true classified, false not classified
                    if (b == true)
                    {
                        RulesCanBeCalssifies.Add(ListRules[j]);
                    }
                }

                // xác định phân lớp đúng cho mẫu
                int[] count = new int[3];
                for (int j = 0; j < RulesCanBeCalssifies.Count; j++)
                {
                    if ((string)RulesCanBeCalssifies[j].AttributeTargets[0] == "-1")
                    {
                        count[0]++;
                    }
                    else if ((string)RulesCanBeCalssifies[j].AttributeTargets[0] == "0")
                    {
                        count[1]++;
                    }
                    else
                    {
                        count[2]++;
                    }
                }
                int max = -1;
                int pos = -1;
                for (int j = 0; j < count.Length; j++)
                {
                    if (max == -1 || max < count[j])
                    {
                        max = count[j];
                        pos = j;
                    }
                }

                // kiểm tra phân lớp đúng sai
                int exampleTargetValue = example[0];

                if (pos == exampleTargetValue)
                {
                    NumExampleCorrect++;
                }
            }
            return(NumExampleCorrect);
        }
        public int ClassifyTest(Dataset testData)
        {
            int NumExampleCorrect = 0;
            int[] example;
            for (int i = 0; i < testData.TrainingSet.Count; i++)
            {
                example = (int[])testData.getTrainingExample(i);
                List<Rule> RulesCanBeCalssifies = new List<Rule>();

                for(int j = 0 ; j < ListRules.Count; j ++)
                {
                    bool b = isClassified(example, ListRules[j], testData);// true classified, false not classified
                    if (b == true)
                    {
                        RulesCanBeCalssifies.Add(ListRules[j]);
                    }
                }

                // xác định phân lớp đúng cho mẫu
                int[] count = new int[3];
                for (int j = 0; j < RulesCanBeCalssifies.Count; j++)
                {
                    if ((string)RulesCanBeCalssifies[j].AttributeTargets[0] == "-1")
                    {
                        count[0]++;
                    }
                    else if ((string)RulesCanBeCalssifies[j].AttributeTargets[0] == "0")
                    {
                        count[1]++;
                    }
                    else
                    {
                        count[2]++;
                    }
                }
                int max = -1;
                int pos = -1;
                for (int j = 0; j < count.Length; j++)
                {
                    if (max == -1 || max < count[j])
                    {
                        max = count[j];
                        pos = j;
                    }
                }

                // kiểm tra phân lớp đúng sai
                int exampleTargetValue = example[0];

                if (pos == exampleTargetValue)
                {
                    NumExampleCorrect++;
                }

            }
            return NumExampleCorrect;
        }
        public List<int> ClassifyAgain(Dataset testData)
        {
            List<int> correctPos = new List<int>();

            int[] example;
            for (int i = 0; i < testData.TrainingSet.Count; i++)
            {
                example = (int[])testData.getTrainingExample(i);

                // Kiểm tra thoả điều kiện chưa?
                List<Rule> RulesCanBeCalssifies = new List<Rule>();
                for (int j = 0; j < ListRules.Count; j++)
                {
                    bool b = isMatchCondition(example, ListRules[j], testData);// true classified, false not classified
                    if (b == true)
                    {
                        RulesCanBeCalssifies.Add(ListRules[j]);
                    }
                }

                // xác định phân lớp đúng cho mẫu
                if (RulesCanBeCalssifies.Count != 0)
                {
                    int[] count = new int[3];
                    for (int j = 0; j < RulesCanBeCalssifies.Count; j++)
                    {
                        if ((string)RulesCanBeCalssifies[j].AttributeTargetValues[0] == "-1")
                        {
                            count[0]++;
                        }
                        else if ((string)RulesCanBeCalssifies[j].AttributeTargetValues[0] == "0")
                        {
                            count[1]++;
                        }
                        else
                        {
                            count[2]++;
                        }
                    }
                    int max = -1;
                    int pos = -1;
                    for (int j = 0; j < count.Length; j++)
                    {
                        if (max == -1 || max < count[j])
                        {
                            max = count[j];
                            pos = j;
                        }
                    }

                    // kiểm tra phân lớp đúng sai
                    int exampleTargetValue = example[0];

                    if (pos == exampleTargetValue)
                    {
                        correctPos.Add(i);
                    }
                }
            }
            return correctPos;
        }
        public List <int> ClassifyAgain(Dataset testData)
        {
            List <int> correctPos = new List <int>();

            int[] example;
            for (int i = 0; i < testData.TrainingSet.Count; i++)
            {
                example = (int[])testData.getTrainingExample(i);

                // Kiểm tra thoả điều kiện chưa?
                List <Rule> RulesCanBeCalssifies = new List <Rule>();
                for (int j = 0; j < ListRules.Count; j++)
                {
                    bool b = isMatchCondition(example, ListRules[j], testData);// true classified, false not classified
                    if (b == true)
                    {
                        RulesCanBeCalssifies.Add(ListRules[j]);
                    }
                }

                // xác định phân lớp đúng cho mẫu
                if (RulesCanBeCalssifies.Count != 0)
                {
                    int[] count = new int[3];
                    for (int j = 0; j < RulesCanBeCalssifies.Count; j++)
                    {
                        if ((string)RulesCanBeCalssifies[j].AttributeTargetValues[0] == "-1")
                        {
                            count[0]++;
                        }
                        else if ((string)RulesCanBeCalssifies[j].AttributeTargetValues[0] == "0")
                        {
                            count[1]++;
                        }
                        else
                        {
                            count[2]++;
                        }
                    }
                    int max = -1;
                    int pos = -1;
                    for (int j = 0; j < count.Length; j++)
                    {
                        if (max == -1 || max < count[j])
                        {
                            max = count[j];
                            pos = j;
                        }
                    }

                    // kiểm tra phân lớp đúng sai
                    int exampleTargetValue = example[0];

                    if (pos == exampleTargetValue)
                    {
                        correctPos.Add(i);
                    }
                }
            }
            return(correctPos);
        }