Пример #1
0
        private void unlaid_protection_fix_max_min_border(int number_of_database = 0)
        {
            for (int i = 0; i < Count_Vars; i++)
            {
                List <Term> all_terms_for_var =
                    rulles_database_set[number_of_database].Terms_Set.FindAll(x => x.Number_of_Input_Var == i);
                if (all_terms_for_var.Find(x => x.Term_Func_Type == Type_Term_Func_Enum.Гауссоида) != null)
                {
                    continue;
                }
                else
                {
                    double min       = all_terms_for_var.Min(x => x.Parametrs[0]);
                    int    min_index = rulles_database_set[number_of_database].Terms_Set.FindIndex(x => (x.Parametrs[0] == min) && (x.Number_of_Input_Var == i));
                    rulles_database_set[number_of_database].Terms_Set[min_index].Parametrs[0] =
                        Learn_Samples_set.Attribute_Min(i) - 0.001 * Learn_Samples_set.Attribute_Scatter(i);

                    double max          = double.NegativeInfinity;
                    Term   current_term = null;
                    for (int j = 0; j < all_terms_for_var.Count; j++)
                    {
                        double current_max = all_terms_for_var[j].Max;
                        if (max < current_max)
                        {
                            max          = current_max;
                            current_term = all_terms_for_var[j];
                        }
                    }
                    current_term.Max = Learn_Samples_set.Attribute_Max(i) +
                                       0.001 * Learn_Samples_set.Attribute_Scatter(i);
                }
            }
        }
Пример #2
0
        public void unlaid_protection_fix(int number_of_database = 0)
        {
            for (int i = 0; i < Count_Vars; i++)
            {
                List <Term> all_terms_for_var =
                    rulles_database_set[number_of_database].Terms_Set.FindAll(x => x.Number_of_Input_Var == i);
                if (all_terms_for_var.Find(x => x.Term_Func_Type == Type_Term_Func_Enum.Гауссоида) != null)
                {
                    continue;
                }
                else
                {
                    double min       = all_terms_for_var.Min(x => x.Parametrs[0]);
                    int    min_index = rulles_database_set[number_of_database].Terms_Set.FindIndex(x => (x.Parametrs[0] == min) && (x.Number_of_Input_Var == i));
                    rulles_database_set[number_of_database].Terms_Set[min_index].Parametrs[0] =
                        Learn_Samples_set.Attribute_Min(i) -
                        0.001 * (Learn_Samples_set.Attribute_Max(i) - Learn_Samples_set.Attribute_Min(i));

                    double max          = double.NegativeInfinity;
                    Term   current_term = null;
                    for (int j = 0; j < all_terms_for_var.Count; j++)
                    {
                        double current_max = double.NegativeInfinity;
                        switch (all_terms_for_var[j].Term_Func_Type)
                        {
                        case Type_Term_Func_Enum.Треугольник:
                            current_max = all_terms_for_var[j].Parametrs[2];
                            break;

                        case Type_Term_Func_Enum.Парабола:
                            current_max = all_terms_for_var[j].Parametrs[1];
                            break;

                        case Type_Term_Func_Enum.Трапеция:
                            current_max = all_terms_for_var[j].Parametrs[3];
                            break;
                        }


                        if (max < current_max)
                        {
                            max          = current_max;
                            current_term = all_terms_for_var[j];
                        }
                    }

                    int max_index = rulles_database_set[number_of_database].Terms_Set.FindIndex(x => x == current_term);

                    switch (current_term.Term_Func_Type)
                    {
                    case Type_Term_Func_Enum.Треугольник: rulles_database_set[number_of_database].Terms_Set[max_index].Parametrs[2] =
                        Learn_Samples_set.Attribute_Max(i) +
                        0.001 * (Learn_Samples_set.Attribute_Max(i) - Learn_Samples_set.Attribute_Min(i));
                        break;

                    case Type_Term_Func_Enum.Парабола: rulles_database_set[number_of_database].Terms_Set[max_index].Parametrs[1] =
                        Learn_Samples_set.Attribute_Max(i) +
                        0.001 * (Learn_Samples_set.Attribute_Max(i) - Learn_Samples_set.Attribute_Min(i));
                        break;

                    case Type_Term_Func_Enum.Трапеция: rulles_database_set[number_of_database].Terms_Set[max_index].Parametrs[3] =
                        Learn_Samples_set.Attribute_Max(i) +
                        0.001 * (Learn_Samples_set.Attribute_Max(i) - Learn_Samples_set.Attribute_Min(i));
                        break;
                    }
                }
            }
        }