コード例 #1
0
        public static double getGICSumReverce(this SAFuzzySystem source, int indexDataBase = 0)
        {
            double result = 0.0;

            if (source != null)
            {
                double temp = 0.0;
                for (int i = 0; i < source.CountFeatures; i++)
                {
                    temp = 0.0;
                    List <Term> termList = source.RulesDatabaseSet[indexDataBase].TermsSet.Where(x => x.NumVar == i).ToList();
                    if (termList.Count() <= 1)
                    {
                        temp = 0.0;
                    }
                    else
                    {
                        for (int j = 0; j < termList.Count; j++)
                        {
                            for (int k = j + 1; k < termList.Count; k++)
                            {
                                temp += 1.0 - TermOnterpreting.getIndexByCentersClose(termList[j], termList[k], termList.Count(), source.LearnSamplesSet.InputAttributes[i].Scatter);
                            }
                        }
                    }
                    result += temp;
                }
                result = result / (double)source.CountFeatures;
            }
            return(result);
        }
コード例 #2
0
        public static double getLindisSumReverse(this SAFuzzySystem source, int indexDataBase = 0)
        {
            double result = 0.0;

            if (source != null)
            {
                double temp = 0.0;
                for (int i = 0; i < source.CountFeatures; i++)
                {
                    temp = 0.0;
                    List <Term> termList = source.RulesDatabaseSet[indexDataBase].TermsSet.Where(x => x.NumVar == i).ToList();
                    if (termList.Count() <= 1)
                    {
                        temp = 0.0;
                    }
                    else
                    {
                        for (int j = 0; j < termList.Count; j++)
                        {
                            for (int k = j + 1; k < termList.Count; k++)
                            {
                                temp += 1 - TermOnterpreting.getIndexByLinds(termList[j], termList[k], termList);
                            }
                        }
                    }
                    result += temp;
                }
                result = result / (double)source.CountFeatures;
            }
            return(result);
        }
コード例 #3
0
        public static double getGISSumReverce(this SAFuzzySystem source, double goodsForArea = 0, int indexDataBase = 0)
        {
            double result = 0.0;

            if (goodsForArea == 0)
            {
                goodsForArea = FuzzyCore.Properties.Settings.Default.Pareto_simpler_UnionTerms_bySqarePercent * 0.01;
            }
            if (source != null)
            {
                double temp = 0.0;
                for (int i = 0; i < source.CountFeatures; i++)
                {
                    temp = 0.0;
                    List <Term> termList = source.RulesDatabaseSet[indexDataBase].TermsSet.Where(x => x.NumVar == i).ToList();
                    if (termList.Count() <= 1)
                    {
                        temp = 0.0;
                    }
                    else
                    {
                        for (int j = 0; j < termList.Count; j++)
                        {
                            for (int k = j + 1; k < termList.Count; k++)
                            {
                                temp += 1 - TermOnterpreting.getIndexByAreaTerms(termList[j], termList[k], goodsForArea);
                            }
                        }
                    }
                    result += temp;
                }
                result = result / (double)source.CountFeatures;
            }
            return(result);
        }
コード例 #4
0
        public override SAFuzzySystem TuneUpFuzzySystem(SAFuzzySystem Approx, ILearnAlgorithmConf conf)
        {
            SAFuzzySystem result        = Approx;
            double        minValue      = 5;
            int           minFeature    = 0;
            int           minATerm      = 0;
            int           minBTerm      = 1;
            int           indexDatabase = 0;

            for (int i = 0; i < result.CountFeatures; i++)
            {
                List <Term> soureceByFeature = result.RulesDatabaseSet[indexDatabase].TermsSet.Where(x => x.NumVar == i).ToList();
                for (int j = 0; j < soureceByFeature.Count(); j++)
                {
                    for (int k = j + 1; k < soureceByFeature.Count(); k++)
                    {
                        double temp = TermOnterpreting.getIndexByLinds(soureceByFeature[j], soureceByFeature[k], soureceByFeature);
                        if (temp < minValue)
                        {
                            minValue   = temp;
                            minATerm   = j;
                            minBTerm   = k;
                            minFeature = i;
                        }
                    }
                }
            }
            result = BreakCrossTerm(result, minFeature, minATerm, minBTerm, indexDatabase);
            result.RulesDatabaseSet[0].TermsSet.Trim();
            return(result);
        }
コード例 #5
0
        public static double getIndexReal(this PCFuzzySystem source, double goodsForBorder = 0, double goodsForAreas = 0, int indexDataBase = 0)
        {
            double result = 0.0;

            if (goodsForBorder == 0)
            {
                goodsForBorder = FuzzyCore.Properties.Settings.Default.Pareto_simpler_UnionTerms_byBorderPercent * 0.01;
            }

            if (goodsForAreas == 0)
            {
                goodsForAreas = FuzzyCore.Properties.Settings.Default.Pareto_simpler_UnionTerms_bySqarePercent * 0.01;
            }

            if (source != null)
            {
                double temp = 0.0;
                for (int i = 0; i < source.CountFeatures; i++)
                {
                    temp = 0.0;
                    List <Term> termList = source.RulesDatabaseSet[indexDataBase].TermsSet.Where(x => x.NumVar == i).ToList();
                    if (termList.Count() <= 1)
                    {
                        temp = 1.0;
                    }
                    else
                    {
                        for (int j = 0; j < termList.Count; j++)
                        {
                            for (int k = j + 1; k < termList.Count; k++)
                            {
                                temp += TermOnterpreting.getG3(termList[j], termList[k], termList.Count(), source.LearnSamplesSet.InputAttributes[i].Scatter, goodsForBorder, goodsForAreas) * TermOnterpreting.getIndexByLinds(termList[j], termList[k], termList);
                            }
                        }
                        temp = temp / (double)((termList.Count() * (termList.Count() - 1)) * 0.5);

                        temp = AlphaIndex(termList.Count(), temp);
                    }

                    result += temp;
                }
                result = result / (double)source.CountFeatures;
            }
            return(result);
        }
コード例 #6
0
ファイル: UnionTerms.cs プロジェクト: CDMMKY/fuzzy_core
        public override PCFuzzySystem TuneUpFuzzySystem(PCFuzzySystem Classifier, ILearnAlgorithmConf conf)
        {
            PCFuzzySystem  result        = Classifier;
            double         minValue      = 1;
            int            minFeature    = 0;
            int            minATerm      = 0;
            int            minBTerm      = 0;
            int            indexDatabase = 0;
            UnionTermsConf Config        = conf as UnionTermsConf;

            allowbyBorder = Config.UTCPercentCrossBorder / 100;
            allowbySqare  = Config.UTCPercentCrossSquare / 100;


            for (int i = 0; i < result.CountFeatures; i++)
            {
                List <Term> soureceByFeature = result.RulesDatabaseSet[indexDatabase].TermsSet.Where(x => x.NumVar == i).ToList();
                for (int j = 0; j < soureceByFeature.Count(); j++)
                {
                    for (int k = j + 1; k < soureceByFeature.Count(); k++)
                    {
                        double temp = TermOnterpreting.getG3(soureceByFeature[j], soureceByFeature[k], soureceByFeature.Count(), result.LearnSamplesSet.InputAttributes[i].Scatter, allowbySqare, allowbyBorder);
                        if (temp < minValue)
                        {
                            minValue   = temp;
                            minATerm   = j;
                            minBTerm   = k;
                            minFeature = i;
                        }
                    }
                }
            }

            result = UniTerm(result, minFeature, minATerm, minBTerm, indexDatabase);
            result.RulesDatabaseSet[0].TermsSet.Trim();
            return(result);
        }
コード例 #7
0
        public static double getGIBNormal(this PCFuzzySystem source, double goodsForBorder = 0, int indexDataBase = 0)
        {
            double result = 0.0;

            if (goodsForBorder == 0)
            {
                goodsForBorder = FuzzyCore.Properties.Settings.Default.Pareto_simpler_UnionTerms_byBorderPercent * 0.01;
            }
            if (source != null)
            {
                double temp = 0.0;
                for (int i = 0; i < source.CountFeatures; i++)
                {
                    temp = 0.0;
                    List <Term> termList = source.RulesDatabaseSet[indexDataBase].TermsSet.Where(x => x.NumVar == i).ToList();
                    if (termList.Count() <= 1)
                    {
                        temp = 1;
                    }
                    else
                    {
                        for (int j = 0; j < termList.Count; j++)
                        {
                            for (int k = j + 1; k < termList.Count; k++)
                            {
                                temp += TermOnterpreting.getIndexByBordersClose(termList[j], termList[k], goodsForBorder);
                            }
                        }
                        temp = temp / ((termList.Count() * (termList.Count() - 1)) * 0.5);
                    }
                    result += temp;
                }
                result = result / (double)source.CountFeatures;
            }
            return(result);
        }