Beispiel #1
0
        protected SymbolicDataAnalysisProblem(T problemData, U evaluator, V solutionCreator)
            : base(evaluator, solutionCreator)
        {
            Parameters.Add(new ValueParameter <T>(ProblemDataParameterName, ProblemDataParameterDescription, problemData));
            Parameters.Add(new ValueParameter <ISymbolicDataAnalysisGrammar>(SymbolicExpressionTreeGrammarParameterName, SymbolicExpressionTreeGrammarParameterDescription));
            Parameters.Add(new ValueParameter <ISymbolicDataAnalysisExpressionTreeInterpreter>(SymbolicExpressionTreeInterpreterParameterName, SymoblicExpressionTreeInterpreterParameterDescription));
            Parameters.Add(new FixedValueParameter <IntValue>(MaximumSymbolicExpressionTreeDepthParameterName, MaximumSymbolicExpressionTreeDepthParameterDescription));
            Parameters.Add(new FixedValueParameter <IntValue>(MaximumSymbolicExpressionTreeLengthParameterName, MaximumSymbolicExpressionTreeLengthParameterDescription));
            Parameters.Add(new FixedValueParameter <IntValue>(MaximumFunctionDefinitionsParameterName, MaximumFunctionDefinitionsParameterDescription));
            Parameters.Add(new FixedValueParameter <IntValue>(MaximumFunctionArgumentsParameterName, MaximumFunctionArgumentsParameterDescription));
            Parameters.Add(new FixedValueParameter <IntRange>(FitnessCalculationPartitionParameterName, FitnessCalculationPartitionParameterDescription));
            Parameters.Add(new FixedValueParameter <IntRange>(ValidationPartitionParameterName, ValidationPartitionParameterDescription));
            Parameters.Add(new FixedValueParameter <PercentValue>(RelativeNumberOfEvaluatedSamplesParameterName, RelativeNumberOfEvaluatedSamplesParameterDescription, new PercentValue(1)));
            Parameters.Add(new FixedValueParameter <BoolValue>(ApplyLinearScalingParameterName, ApplyLinearScalingParameterDescription, new BoolValue(false)));

            SymbolicExpressionTreeInterpreterParameter.Hidden = true;
            MaximumFunctionArgumentsParameter.Hidden          = true;
            MaximumFunctionDefinitionsParameter.Hidden        = true;
            ApplyLinearScalingParameter.Hidden = true;

            SymbolicExpressionTreeGrammar     = new TypeCoherentExpressionGrammar();
            SymbolicExpressionTreeInterpreter = new SymbolicDataAnalysisExpressionTreeLinearInterpreter();

            FitnessCalculationPartition.Start = ProblemData.TrainingPartition.Start;
            FitnessCalculationPartition.End   = ProblemData.TrainingPartition.End;

            InitializeOperators();

            UpdateGrammar();
            RegisterEventHandlers();
        }
Beispiel #2
0
 private SymbolicDataAnalysisExpressionTreeLinearInterpreter(SymbolicDataAnalysisExpressionTreeLinearInterpreter original, Cloner cloner)
     : base(original, cloner)
 {
     interpreter = cloner.Clone(original.interpreter);
 }
    private static ISymbolicRegressionSolution CreateSymbolicSolution(List<IRegressionModel> models, double nu, IRegressionProblemData problemData) {
      var symbModels = models.OfType<ISymbolicRegressionModel>();
      var lowerLimit = symbModels.Min(m => m.LowerEstimationLimit);
      var upperLimit = symbModels.Max(m => m.UpperEstimationLimit);
      var interpreter = new SymbolicDataAnalysisExpressionTreeLinearInterpreter();
      var progRootNode = new ProgramRootSymbol().CreateTreeNode();
      var startNode = new StartSymbol().CreateTreeNode();

      var addNode = new Addition().CreateTreeNode();
      var mulNode = new Multiplication().CreateTreeNode();
      var scaleNode = (ConstantTreeNode)new Constant().CreateTreeNode(); // all models are scaled using the same nu
      scaleNode.Value = nu;

      foreach (var m in symbModels) {
        var relevantPart = m.SymbolicExpressionTree.Root.GetSubtree(0).GetSubtree(0); // skip root and start
        addNode.AddSubtree((ISymbolicExpressionTreeNode)relevantPart.Clone());
      }

      mulNode.AddSubtree(addNode);
      mulNode.AddSubtree(scaleNode);
      startNode.AddSubtree(mulNode);
      progRootNode.AddSubtree(startNode);
      var t = new SymbolicExpressionTree(progRootNode);
      var combinedModel = new SymbolicRegressionModel(problemData.TargetVariable, t, interpreter, lowerLimit, upperLimit);
      var sol = new SymbolicRegressionSolution(combinedModel, problemData);
      return sol;
    }
 private SymbolicDataAnalysisExpressionTreeLinearInterpreter(SymbolicDataAnalysisExpressionTreeLinearInterpreter original, Cloner cloner)
   : base(original, cloner) {
   interpreter = cloner.Clone(original.interpreter);
 }