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); }
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); }