Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/23/13 13:31:29 (12 years ago)
Author:
sforsten
Message:

#1980:

  • several small bug fixes
  • added windowing technique ILAS to GAssist
  • GAssist and XCS work now with real-valued features
  • severely improved the performance of XCS
Location:
branches/LearningClassifierSystems/HeuristicLab.Algorithms.GAssist/3.3
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/LearningClassifierSystems/HeuristicLab.Algorithms.GAssist/3.3

    • Property svn:ignore
      •  

        old new  
        11*.user
        22Plugin.cs
         3obj
  • branches/LearningClassifierSystems/HeuristicLab.Algorithms.GAssist/3.3/GAssist.cs

    r9352 r9392  
    6565      get { return (ValueParameter<IntValue>)Parameters["PopulationSize"]; }
    6666    }
     67    public ValueParameter<MDLIterationOperator> MDLIterationOperatorParameter {
     68      get { return (ValueParameter<MDLIterationOperator>)Parameters["MDLIterationOperator"]; }
     69    }
    6770    public IConstrainedValueParameter<IDefaultRuleOperator> DefaultRuleParameter {
    6871      get { return (IConstrainedValueParameter<IDefaultRuleOperator>)Parameters["DefaultRule"]; }
     
    121124    private ValueParameter<ItemCollection<IDiscretizer>> DiscretizersParameter {
    122125      get { return (ValueParameter<ItemCollection<IDiscretizer>>)Parameters["Discretizers"]; }
     126    }
     127    public ValueParameter<IntValue> MDLActivationIterationParameter {
     128      get { return (ValueParameter<IntValue>)Parameters["MDLActivationIteration"]; }
     129    }
     130    public ValueParameter<DoubleValue> InitialTheoryLengthRatioParameter {
     131      get { return (ValueParameter<DoubleValue>)Parameters["InitialTheoryLengthRatio"]; }
     132    }
     133    public ValueParameter<DoubleValue> WeightRelaxFactorParameter {
     134      get { return (ValueParameter<DoubleValue>)Parameters["WeightRelaxFactor"]; }
     135    }
     136    public ValueParameter<IntValue> WeightAdaptionIterationsParameter {
     137      get { return (ValueParameter<IntValue>)Parameters["WeightAdaptionIterations"]; }
     138    }
     139    public ValueParameter<IntValue> NumberOfStrataParameter {
     140      get { return (ValueParameter<IntValue>)Parameters["NumberOfStrata"]; }
    123141    }
    124142    #endregion
     
    180198      get { return (RandomCreator)OperatorGraph.InitialOperator; }
    181199    }
     200    private VariableCreator VariableCreator {
     201      get { return (VariableCreator)RandomCreator.Successor; }
     202    }
     203    private Placeholder MDLIterationPlaceholder {
     204      get { return (Placeholder)VariableCreator.Successor; }
     205    }
     206    private ILASOperator ILASOperator {
     207      get { return (ILASOperator)MDLIterationPlaceholder.Successor; }
     208    }
     209    private InitializeDiscretizersOperator InitializeDiscretizers {
     210      get { return (InitializeDiscretizersOperator)ILASOperator.Successor; }
     211    }
    182212    private SolutionsCreator SolutionsCreator {
    183       get { return (SolutionsCreator)RandomCreator.Successor; }
     213      get { return (SolutionsCreator)InitializeDiscretizers.Successor; }
    184214    }
    185215    private GAssistMainLoop GeneticAlgorithmMainLoop {
     
    204234      Parameters.Add(new ValueParameter<GAssistSpecialStageMultiOperator>("SpecialStages", "", new GAssistSpecialStageMultiOperator()));
    205235      Parameters.Add(new ValueParameter<IntValue>("MaximumGenerations", "The maximum number of generations which should be processed.", new IntValue(1000)));
    206       Parameters.Add(new FixedValueParameter<PercentValue>("SplitProbability", "", new PercentValue(0.05)));
    207       Parameters.Add(new FixedValueParameter<PercentValue>("MergeProbability", "", new PercentValue(0.05)));
    208       Parameters.Add(new FixedValueParameter<PercentValue>("StartReinitializeProbability", "", new PercentValue(0.05)));
    209       Parameters.Add(new FixedValueParameter<PercentValue>("EndReinitializeProbability", "", new PercentValue(Double.Epsilon)));
    210       Parameters.Add(new FixedValueParameter<PercentValue>("OneProbability", "", new PercentValue(0.75)));
    211       Parameters.Add(new FixedValueParameter<IntValue>("MaximumNumberOfIntervals", "", new IntValue(5)));
    212       Parameters.Add(new FixedValueParameter<IntValue>("InitialNumberOfRules", "", new IntValue(20)));
     236      Parameters.Add(new ValueParameter<PercentValue>("SplitProbability", "", new PercentValue(0.05)));
     237      Parameters.Add(new ValueParameter<PercentValue>("MergeProbability", "", new PercentValue(0.05)));
     238      Parameters.Add(new ValueParameter<PercentValue>("StartReinitializeProbability", "", new PercentValue(0.05)));
     239      Parameters.Add(new ValueParameter<PercentValue>("EndReinitializeProbability", "", new PercentValue(Double.Epsilon)));
     240      Parameters.Add(new ValueParameter<PercentValue>("OneProbability", "", new PercentValue(0.75)));
     241      Parameters.Add(new ValueParameter<IntValue>("MaximumNumberOfIntervals", "", new IntValue(5)));
     242      Parameters.Add(new ValueParameter<IntValue>("InitialNumberOfRules", "", new IntValue(20)));
     243      Parameters.Add(new ValueParameter<MDLIterationOperator>("MDLIterationOperator", "", new MDLIterationOperator()));
    213244      Parameters.Add(new ConstrainedValueParameter<IDefaultRuleOperator>("DefaultRule", ""));
    214245      Parameters.Add(new ConstrainedValueParameter<IDiscreteDoubleValueModifier>("ReinitializeCurveOperator", ""));
    215246      Parameters.Add(new ValueParameter<ItemCollection<IDiscretizer>>("Discretizers", "", new ItemCollection<IDiscretizer>()));
    216247
     248      Parameters.Add(new ValueParameter<IntValue>("MDLActivationIteration", "", new IntValue(25)));
     249      Parameters.Add(new ValueParameter<DoubleValue>("InitialTheoryLengthRatio", "", new DoubleValue(0.075)));
     250      Parameters.Add(new ValueParameter<DoubleValue>("WeightRelaxFactor", "", new DoubleValue(0.9)));
     251      Parameters.Add(new ValueParameter<IntValue>("WeightAdaptionIterations", "", new IntValue(10)));
     252
     253      Parameters.Add(new ValueParameter<IntValue>("NumberOfStrata", "", new IntValue(2)));
     254
    217255      RandomCreator randomCreator = new RandomCreator();
     256      VariableCreator variableCreator = new VariableCreator();
     257      Placeholder mdlIterationPlaceholder = new Placeholder();
     258      ILASOperator ilasOperator = new ILASOperator();
     259      InitializeDiscretizersOperator initializeDiscretizers = new InitializeDiscretizersOperator();
    218260      SolutionsCreator solutionsCreator = new SolutionsCreator();
    219261      SubScopesCounter subScopesCounter = new SubScopesCounter();
     
    227269      randomCreator.SetSeedRandomlyParameter.ActualName = SetSeedRandomlyParameter.Name;
    228270      randomCreator.SetSeedRandomlyParameter.Value = null;
    229       randomCreator.Successor = solutionsCreator;
     271      randomCreator.Successor = variableCreator;
     272
     273      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Generations", new IntValue(0))); // Class GAssistMainLoop expects this to be called Generations
     274      variableCreator.Successor = mdlIterationPlaceholder;
     275
     276      mdlIterationPlaceholder.Name = "MDL Iteration Operator";
     277      mdlIterationPlaceholder.OperatorParameter.ActualName = MDLIterationOperatorParameter.Name;
     278      mdlIterationPlaceholder.Successor = ilasOperator;
     279
     280      ilasOperator.RandomParameter.ActualName = randomCreator.RandomParameter.ActualName;
     281      ilasOperator.NumberOfStrataParameter.ActualName = NumberOfStrataParameter.Name;
     282      ilasOperator.Successor = initializeDiscretizers;
     283
     284      initializeDiscretizers.DiscretizersParameter.ActualName = DiscretizersParameter.Name;
     285      initializeDiscretizers.Successor = solutionsCreator;
    230286
    231287      solutionsCreator.NumberOfSolutionsParameter.ActualName = PopulationSizeParameter.Name;
     
    240296      resultsCollector.Successor = mainLoop;
    241297
     298      mainLoop.MDLIterationParameter.ActualName = MDLIterationOperatorParameter.Name;
    242299      mainLoop.DefaultRuleParameter.ActualName = DefaultRuleParameter.Name;
    243300      mainLoop.SelectorParameter.ActualName = SelectorParameter.Name;
     
    348405      ParameterizeStochasticOperator(Problem.SolutionCreator);
    349406      ParameterizeStochasticOperator(Problem.Evaluator);
    350       foreach (IOperator op in Problem.Operators.OfType<IOperator>()) ParameterizeStochasticOperator(op);
     407      ParameterizeMDLOperator(Problem.Evaluator);
     408      ParameterizeIterationBasedOperators(Problem.Evaluator);
     409      foreach (IOperator op in Problem.Operators.OfType<IOperator>()) {
     410        ParameterizeStochasticOperator(op);
     411      }
    351412      ParameterizeSolutionsCreator();
    352413      ParameterizeGeneticAlgorithmMainLoop();
     414      ParameterizeMDL();
    353415      ParameterizeSelectors();
    354416      ParameterizeAnalyzers();
     
    359421      UpdateAnalyzers();
    360422      Problem.Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged);
     423      ILASOperator.ProblemDataParameter.ActualName = Problem.ProblemDataParameter.Name;
     424      InitializeDiscretizers.ProblemDataParameter.ActualName = Problem.ProblemDataParameter.Name;
    361425      base.OnProblemChanged();
     426    }
     427
     428    private void ParameterizeMDL() {
     429      MDLIterationOperatorParameter.Value.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName;
     430      //change
     431      MDLIterationOperatorParameter.Value.IndividualParameter.ActualName = "DecisionList";
     432      MDLIterationOperatorParameter.Value.ProblemDataParameter.ActualName = Problem.ProblemDataParameter.Name;
     433      MDLIterationOperatorParameter.Value.MaximizationParameter.ActualName = Problem.MaximizationParameter.Name;
     434
     435      MDLIterationOperatorParameter.Value.InitialTheoryLengthRatioParameter.ActualName = InitialTheoryLengthRatioParameter.Name;
     436      MDLIterationOperatorParameter.Value.MDLActivationIterationParameter.ActualName = MDLActivationIterationParameter.Name;
     437      MDLIterationOperatorParameter.Value.WeightAdaptionIterationsParameter.ActualName = WeightAdaptionIterationsParameter.Name;
     438      MDLIterationOperatorParameter.Value.WeightRelaxFactorParameter.ActualName = WeightRelaxFactorParameter.Name;
     439      MDLIterationOperatorParameter.Value.IterationsParameter.ActualName = "Generations";
    362440    }
    363441
     
    374452      ParameterizeAnalyzers();
    375453      Problem.Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged);
     454      Problem.Evaluator.StrataParameter.ActualName = ILASOperator.StrataParameter.ActualName;
    376455      base.Problem_EvaluatorChanged(sender, e);
    377456    }
     
    433512        stochasticOp.RandomParameter.ActualName = RandomCreator.RandomParameter.ActualName;
    434513        stochasticOp.RandomParameter.Hidden = true;
     514      }
     515    }
     516    private void ParameterizeMDLOperator(IOperator op) {
     517      IMDLCalculatorBasedOperator stochasticOp = op as IMDLCalculatorBasedOperator;
     518      if (stochasticOp != null) {
     519        stochasticOp.MDLCalculatorParameter.ActualName = MDLIterationOperatorParameter.Value.MDLCalculatorParameter.ActualName;
    435520      }
    436521    }
     
    469554      }
    470555    }
     556    private void ParameterizeIterationBasedOperators(IOperator op) {
     557      IIterationBasedOperator iterationOp = op as IIterationBasedOperator;
     558      if (iterationOp != null) {
     559        ParameterizeIterationBasedOperators(iterationOp);
     560      }
     561    }
     562    private void ParameterizeIterationBasedOperators(IIterationBasedOperator op) {
     563      op.IterationsParameter.ActualName = "Generations";
     564      op.IterationsParameter.Hidden = true;
     565      op.MaximumIterationsParameter.ActualName = "MaximumGenerations";
     566      op.MaximumIterationsParameter.Hidden = true;
     567    }
    471568    private void ParameterizeIterationBasedOperators() {
    472569      if (Problem != null) {
    473570        foreach (IIterationBasedOperator op in Problem.Operators.OfType<IIterationBasedOperator>()) {
    474           op.IterationsParameter.ActualName = "Generations";
    475           op.IterationsParameter.Hidden = true;
    476           op.MaximumIterationsParameter.ActualName = "MaximumGenerations";
    477           op.MaximumIterationsParameter.Hidden = true;
     571          ParameterizeIterationBasedOperators(op);
    478572        }
    479573      }
  • branches/LearningClassifierSystems/HeuristicLab.Algorithms.GAssist/3.3/GAssistMainLoop.cs

    r9352 r9392  
    6161    public ValueLookupParameter<IOperator> MutatorParameter {
    6262      get { return (ValueLookupParameter<IOperator>)Parameters["Mutator"]; }
     63    }
     64    public ValueLookupParameter<IOperator> MDLIterationParameter {
     65      get { return (ValueLookupParameter<IOperator>)Parameters["MDLIteration"]; }
    6366    }
    6467    public ValueLookupParameter<IOperator> DefaultRuleParameter {
     
    134137      Parameters.Add(new ValueLookupParameter<IOperator>("ReinitializationProbabilityOperator", ""));
    135138      Parameters.Add(new ValueLookupParameter<IOperator>("DefaultRule", ""));
     139      Parameters.Add(new ValueLookupParameter<IOperator>("MDLIteration", ""));
    136140      Parameters.Add(new ScopeParameter("CurrentScope", "The current scope which represents a population of solutions on which the genetic algorithm should be applied."));
    137141      #endregion
    138142
    139143      #region Create operators
    140       VariableCreator variableCreator = new VariableCreator();
    141144      ResultsCollector resultsCollector1 = new ResultsCollector();
    142145      Placeholder analyzer1 = new Placeholder();
     146      Placeholder mdlIterationOperator = new Placeholder();
     147      Placeholder defaultRuleOperator = new Placeholder();
    143148      Placeholder reinitializationProbabilityOperator = new Placeholder();
    144       Placeholder defaultRuleOperator = new Placeholder();
    145149      Placeholder selector = new Placeholder();
    146150      SubScopesProcessor subScopesProcessor1 = new SubScopesProcessor();
     
    167171      ConditionalBranch conditionalBranch = new ConditionalBranch();
    168172
    169       variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Generations", new IntValue(0))); // Class GeneticAlgorithm expects this to be called Generations
    170 
    171173      resultsCollector1.CollectedValues.Add(new LookupParameter<IntValue>("Generations"));
    172174      resultsCollector1.ResultsParameter.ActualName = "Results";
     
    174176      analyzer1.Name = "Analyzer";
    175177      analyzer1.OperatorParameter.ActualName = "Analyzer";
     178
     179      mdlIterationOperator.Name = "MDL Iteration Operator";
     180      mdlIterationOperator.OperatorParameter.ActualName = MDLIterationParameter.Name;
    176181
    177182      defaultRuleOperator.Name = "Default Rule Operator";
     
    234239
    235240      #region Create operator graph
    236       OperatorGraph.InitialOperator = variableCreator;
    237       variableCreator.Successor = resultsCollector1;
     241      OperatorGraph.InitialOperator = resultsCollector1;
    238242      resultsCollector1.Successor = analyzer1;
    239       analyzer1.Successor = defaultRuleOperator;
     243      analyzer1.Successor = mdlIterationOperator;
     244      mdlIterationOperator.Successor = defaultRuleOperator;
    240245      defaultRuleOperator.Successor = reinitializationProbabilityOperator;
    241246      reinitializationProbabilityOperator.Successor = selector;
     
    272277      comparator.Successor = analyzer2;
    273278      analyzer2.Successor = conditionalBranch;
    274       conditionalBranch.FalseBranch = defaultRuleOperator;
     279      conditionalBranch.FalseBranch = mdlIterationOperator;
    275280      conditionalBranch.TrueBranch = null;
    276281      conditionalBranch.Successor = null;
Note: See TracChangeset for help on using the changeset viewer.