- Timestamp:
- 10/28/21 14:31:33 (3 years ago)
- Location:
- branches/3136_Structural_GP
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3136_Structural_GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/StructuredSymbolicRegressionSingleObjectiveProblem.cs
r18071 r18072 23 23 private const string StructureDefinitionParameterName = "Structure Definition"; 24 24 private const string StructureTemplateParameterName = "Structure Template"; 25 #endregion 26 27 #region Parameter 25 26 private const string StructureTemplateDescriptionText = 27 "Enter your expression as string in infix format into the empty input field.\n" + 28 "By checking the \"Apply Linear Scaling\" checkbox you can add the relevant scaling terms to your expression.\n" + 29 "After entering the expression click parse to build the tree.\n" + 30 "To edit the defined sub-functions, click on the coressponding colored node in the tree view."; 31 #endregion 32 33 #region Parameters 28 34 public IValueParameter<IRegressionProblemData> ProblemDataParameter => (IValueParameter<IRegressionProblemData>)Parameters[ProblemDataParameterName]; 29 35 public IFixedValueParameter<StringValue> StructureDefinitionParameter => (IFixedValueParameter<StringValue>)Parameters[StructureDefinitionParameterName]; … … 69 75 70 76 Parameters.Add(new ValueParameter<IRegressionProblemData>(ProblemDataParameterName, problemData)); 71 Parameters.Add(new FixedValueParameter<StructureTemplate>(StructureTemplateParameterName, structureTemplate)); 72 73 } 74 75 public StructuredSymbolicRegressionSingleObjectiveProblem(StructuredSymbolicRegressionSingleObjectiveProblem original, Cloner cloner) { } 77 Parameters.Add(new FixedValueParameter<StructureTemplate>(StructureTemplateParameterName, 78 StructureTemplateDescriptionText, structureTemplate)); 79 80 81 } 82 83 public StructuredSymbolicRegressionSingleObjectiveProblem(StructuredSymbolicRegressionSingleObjectiveProblem original, 84 Cloner cloner) : base(original, cloner){ } 76 85 77 86 [StorableConstructor] … … 114 123 if (results.TryGetValue("Best Tree", out IResult result)) { 115 124 var tree = BuildTree(individuals[bestIdx]); 116 AdjustLinearScalingParams(tree, Interpreter); 125 if (StructureTemplate.ApplyLinearScaling) 126 AdjustLinearScalingParams(tree, Interpreter); 117 127 result.Value = tree; 118 128 } 119 129 else { 120 130 var tree = BuildTree(individuals[bestIdx]); 121 AdjustLinearScalingParams(tree, Interpreter); 131 if (StructureTemplate.ApplyLinearScaling) 132 AdjustLinearScalingParams(tree, Interpreter); 122 133 results.Add(new Result("Best Tree", tree)); 123 134 } … … 128 139 var tree = BuildTree(individual); 129 140 130 AdjustLinearScalingParams(tree, Interpreter); 141 if (StructureTemplate.ApplyLinearScaling) 142 AdjustLinearScalingParams(tree, Interpreter); 131 143 var estimationInterval = ProblemData.VariableRanges.GetInterval(ProblemData.TargetVariable); 132 144 var quality = SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator.Calculate( -
branches/3136_Structural_GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/StructureTemplate/StructureTemplate.cs
r18071 r18072 38 38 39 39 [Storable] 40 public IReadOnlyDictionary<string, SubFunction> SubFunctions { get; private set; } 40 public IReadOnlyDictionary<string, SubFunction> SubFunctions { get; private set; } = new Dictionary<string, SubFunction>(); 41 41 42 42 [Storable] … … 66 66 protected StructureTemplate(StorableConstructorFlag _) : base(_) { } 67 67 68 protected StructureTemplate(StructureTemplate original, Cloner cloner) { }68 protected StructureTemplate(StructureTemplate original, Cloner cloner) : base(original, cloner) { } 69 69 #endregion 70 70 … … 73 73 new StructureTemplate(this, cloner); 74 74 #endregion 75 76 75 77 76 78 private Dictionary<string, SubFunction> GetSubFunctions() { -
branches/3136_Structural_GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/StructureTemplate/SubFunction.cs
r18071 r18072 63 63 private void OnParameterValueChanged(object sender, EventArgs e) => Changed?.Invoke(this, EventArgs.Empty); 64 64 65 protected SubFunction(SubFunction original, Cloner cloner) {65 protected SubFunction(SubFunction original, Cloner cloner) : base(original, cloner) { 66 66 Arguments = original.Arguments; 67 67 }
Note: See TracChangeset
for help on using the changeset viewer.