Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/14/13 15:23:17 (12 years ago)
Author:
sforsten
Message:

#1980:

  • added XCSSolution, XCSModel, XCSClassifier to represent the xcs classifier
  • XCSSolution also shows the current accuracy (training and test partition has to be added)
  • added XCSSolutionAnalyzer to create a XCSSolution during the run of the algorithm
  • added XCSModelView to show the xcs model
  • fixed a bug in XCSDeletionOperator (sometimes it deleted less classifiers than it should)
  • moved some parameter from ConditionActionClassificationProblem to ConditionActionClassificationProblemData
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/LearningClassifierSystems/HeuristicLab.Algorithms.LearningClassifierSystems/3.3/LearningClassifierSystemMainLoop.cs

    r9110 r9154  
    5555      get { return (IConstrainedValueParameter<IOperator>)Parameters["AfterCrossover"]; }
    5656    }
     57    public LookupParameter<IntValue> MaxIterationsParameter {
     58      get { return (LookupParameter<IntValue>)Parameters["MaxIterations"]; }
     59    }
     60    public ValueLookupParameter<IOperator> AnalyzerParameter {
     61      get { return (ValueLookupParameter<IOperator>)Parameters["Analyzer"]; }
     62    }
    5763    #endregion
    5864
     
    97103      XCSAfterCrossoverOperator afterCrossover = new XCSAfterCrossoverOperator();
    98104      Parameters.Add(new ConstrainedValueParameter<IOperator>("AfterCrossover", "The operator used to select solutions for reproduction.", new ItemSet<IOperator>() { new XCSAfterCrossoverOperator() }, afterCrossover));
     105      Parameters.Add(new LookupParameter<IntValue>("MaxIterations", "The maximum number of iterations the algorithm will do."));
     106      Parameters.Add(new ValueLookupParameter<IOperator>("Analyzer", "The operator used to analyze each generation."));
    99107      #endregion
     108
     109
     110      //test
     111      DataReducer testReducer = new DataReducer();
     112      testReducer.TargetParameter.ActualName = "TestCurrentPopulation";
     113      testReducer.ParameterToReduce.ActualName = "Numerosity";
     114      testReducer.ReductionOperation.Value = new ReductionOperation(ReductionOperations.Sum);
     115      testReducer.TargetOperation.Value = new ReductionOperation(ReductionOperations.Assign);
    100116
    101117      #region Create operators
    102118      VariableCreator variableCreator = new VariableCreator();
     119      ResultsCollector resultsCollector = new ResultsCollector();
     120      Placeholder finalAnalyzer = new Placeholder();
    103121      ConditionalBranch initialPopulationConditionalBranch = new ConditionalBranch();
    104122      initialSolutionsCreator = new SolutionsCreator();
    105123      Assigner initialPopulationSizeAssigner = new Assigner();
     124      Comparator maxIterationsComparator = new Comparator();
     125      ConditionalBranch terminationConditionalBranch1 = new ConditionalBranch();
    106126      IntCounter iterationCounter = new IntCounter();
    107127      UniformSubScopesProcessor matchCondtionSubScopesProcessor = new UniformSubScopesProcessor();
     
    159179      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("CurrentPopulationSize", new IntValue(0)));
    160180
     181      resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("Iteration"));
     182      resultsCollector.ResultsParameter.ActualName = "Results";
     183
     184      finalAnalyzer.Name = "Analyzer";
     185      finalAnalyzer.OperatorParameter.ActualName = "Analyzer";
     186
    161187      initialPopulationConditionalBranch.ConditionParameter.ActualName = "CreateInitialPopulation";
    162188
     
    165191      initialPopulationSizeAssigner.LeftSideParameter.ActualName = "CurrentPopulationSize";
    166192      initialPopulationSizeAssigner.RightSideParameter.ActualName = "N";
     193
     194      maxIterationsComparator.Comparison = new Comparison(ComparisonType.GreaterOrEqual);
     195      maxIterationsComparator.LeftSideParameter.ActualName = "Iteration";
     196      maxIterationsComparator.RightSideParameter.ActualName = MaxIterationsParameter.ActualName;
     197      maxIterationsComparator.ResultParameter.ActualName = "TerminateMaxIterations";
     198
     199      terminationConditionalBranch1.ConditionParameter.ActualName = "TerminateMaxIterations";
    167200
    168201      iterationCounter.ValueParameter.ActualName = "Iteration";
     
    311344      OperatorGraph.InitialOperator = variableCreator;
    312345
    313       variableCreator.Successor = initialPopulationConditionalBranch;
     346      variableCreator.Successor = resultsCollector;
     347      resultsCollector.Successor = initialPopulationConditionalBranch;
    314348      initialPopulationConditionalBranch.TrueBranch = initialSolutionsCreator;
    315349      initialSolutionsCreator.Successor = initialPopulationSizeAssigner;
    316350      initialPopulationConditionalBranch.FalseBranch = new EmptyOperator();
    317       initialPopulationConditionalBranch.Successor = classifierFetcher;
     351      initialPopulationConditionalBranch.Successor = maxIterationsComparator;
     352      maxIterationsComparator.Successor = terminationConditionalBranch1;
     353      terminationConditionalBranch1.TrueBranch = finalAnalyzer;
     354      terminationConditionalBranch1.FalseBranch = classifierFetcher;
    318355      classifierFetcher.Successor = matchCondtionSubScopesProcessor;
    319356      matchCondtionSubScopesProcessor.Operator = matchConditionOperator;
     
    371408      deletionSelectorAfterGA.Successor = leftReducerAfterGA;
    372409      leftReducerAfterGA.Successor = iterationCounter;
    373       iterationCounter.Successor = classifierFetcher;
     410      //iterationCounter.Successor = maxIterationsComparator;
     411
     412      iterationCounter.Successor = testReducer;
     413      testReducer.Successor = maxIterationsComparator;
    374414      #endregion
    375415    }
Note: See TracChangeset for help on using the changeset viewer.