public override ILearnAlgorithmConf getConf(int CountFeatures) { ILearnAlgorithmConf result = new OptimizeTermShrinkHardCoreConf(); result.Init(CountFeatures); return(result); }
public override SAFuzzySystem TuneUpFuzzySystem(FuzzySystem.SingletoneApproximate.SAFuzzySystem Approximate, ILearnAlgorithmConf config) { theFuzzySystem = Approximate; if (theFuzzySystem.RulesDatabaseSet.Count == 0) { throw new System.FormatException("Что то не то с входными данными"); } OptimizeTermShrinkHardCoreConf Config = config as OptimizeTermShrinkHardCoreConf; count_shrink = Config.OTSHCCountShrinkTerm; for (int i = 0; i < Approximate.CountFeatures; i++) { int count_terms_for_var = Approximate.RulesDatabaseSet[0].TermsSet.FindAll(x => x.NumVar == i).Count; if (count_terms_for_var >= count_shrink) { int shrinkcounter = count_shrink; List <int> Varians_of_cut = new List <int>(); for (int j = 0; j < count_terms_for_var; j++) { if (shrinkcounter > 0) { Varians_of_cut.Add(0); } else { Varians_of_cut.Add(1); } shrinkcounter--; } Generate_all_variant_in_pool(Varians_of_cut); for (int j = 0; j < Pull_of_systems.Count; j++) { KnowlegeBaseSARules current = MakeCut(Approximate.RulesDatabaseSet[0], Pull_of_systems[j], i); Systems_ready_to_test.Add(current); errors_of_systems.Add(theFuzzySystem.approxLearnSamples(current)); } Pull_of_systems.Clear(); } } int best_index = errors_of_systems.IndexOf(errors_of_systems.Min()); theFuzzySystem.RulesDatabaseSet[0] = Systems_ready_to_test[best_index]; return(theFuzzySystem); }