- Timestamp:
- 12/16/21 10:17:00 (3 years ago)
- Location:
- branches/3140_NumberSymbol
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3140_NumberSymbol/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TreeMatching/SymbolicExpressionTreeBottomUpSimilarityCalculator.cs
r18114 r18140 41 41 protected override bool IsCommutative { get { return true; } } 42 42 43 public bool Match ParameterValues { get; set; }43 public bool MatchNumericValues { get; set; } 44 44 public bool MatchVariableWeights { get; set; } 45 45 … … 74 74 75 75 public static NodeMap ComputeBottomUpMapping(ISymbolicExpressionTreeNode n1, ISymbolicExpressionTreeNode n2, bool strict = false) { 76 var calculator = new SymbolicExpressionTreeBottomUpSimilarityCalculator { Match ParameterValues = strict, MatchVariableWeights = strict };76 var calculator = new SymbolicExpressionTreeBottomUpSimilarityCalculator { MatchNumericValues = strict, MatchVariableWeights = strict }; 77 77 return calculator.ComputeBottomUpMapping(n1, n2); 78 78 } … … 211 211 212 212 if (node is INumericTreeNode numNode) 213 return Match ParameterValues ? numNode.Value.ToString(CultureInfo.InvariantCulture) : "Numeric";213 return MatchNumericValues ? numNode.Value.ToString(CultureInfo.InvariantCulture) : "Numeric"; 214 214 215 215 if (node is VariableTreeNode variable) -
branches/3140_NumberSymbol/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TreeMatching/SymbolicExpressionTreeNodeEqualityComparer.cs
r18114 r18140 33 33 protected SymbolicExpressionTreeNodeEqualityComparer(SymbolicExpressionTreeNodeEqualityComparer original, Cloner cloner) 34 34 : base(original, cloner) { 35 match ParameterValues = original.matchParameterValues;35 matchNumericValues = original.matchNumericValues; 36 36 matchVariableNames = original.matchVariableNames; 37 37 matchVariableWeights = original.matchVariableWeights; … … 41 41 // more flexible matching criteria 42 42 [Storable] 43 private bool match ParameterValues;43 private bool matchNumericValues; 44 44 public bool MatchParameterValues { 45 get { return match ParameterValues; }46 set { match ParameterValues = value; }45 get { return matchNumericValues; } 46 set { matchNumericValues = value; } 47 47 } 48 48 … … 66 66 67 67 public SymbolicExpressionTreeNodeEqualityComparer() { 68 match ParameterValues = true;68 matchNumericValues = true; 69 69 matchVariableNames = true; 70 70 matchVariableWeights = true; -
branches/3140_NumberSymbol/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/DataAnalysisProblemData.cs
r18034 r18140 189 189 if (variableRanges == null) { 190 190 variableRanges = Dataset.GetVariableRanges(); 191 } 191 }else { 192 foreach (var entry in variableRanges.GetVariableIntervals()) 193 VariableRanges.SetInterval(entry.Item1, entry.Item2); 194 } 195 192 196 Parameters.Add(new FixedValueParameter<IntervalCollection>(VariableRangesParameterName, variableRanges)); 193 197 -
branches/3140_NumberSymbol/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionProblemData.cs
r18034 r18140 158 158 159 159 public RegressionProblemData(IDataset dataset, IEnumerable<string> allowedInputVariables, string targetVariable, 160 IEnumerable<ITransformation> transformations = null/*, 161 IntervalCollection variableRanges = null*/) 162 : base(dataset, allowedInputVariables, transformations ?? Enumerable.Empty<ITransformation>()) { 160 IEnumerable<ITransformation> transformations = null, IntervalCollection variableRanges = null) 161 : base(dataset, allowedInputVariables, transformations, variableRanges) { 163 162 var variables = InputVariables.Select(x => x.AsReadOnly()).ToList(); 164 163 Parameters.Add(new ConstrainedValueParameter<StringValue>(TargetVariableParameterName, new ItemSet<StringValue>(variables), variables.Where(x => x.Value == targetVariable).First())); 165 /*if (variableRanges == null) { 166 variableRanges = Dataset.GetVariableRanges(); 167 } 168 Parameters.Add(new FixedValueParameter<IntervalCollection>(VariableRangesParameterName, variableRanges));*/ 164 169 165 } 170 166 private void RegisterParameterEvents() { -
branches/3140_NumberSymbol/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/ShapeConstrainedRegressionProblemData.cs
r18117 r18140 144 144 public ShapeConstrainedRegressionProblemData(IRegressionProblemData regressionProblemData) 145 145 : this(regressionProblemData.Dataset, regressionProblemData.AllowedInputVariables, regressionProblemData.TargetVariable, 146 regressionProblemData.TrainingPartition, regressionProblemData.TestPartition, regressionProblemData.Transformations, 147 (regressionProblemData is ShapeConstrainedRegressionProblemData) ? ((ShapeConstrainedRegressionProblemData)regressionProblemData).ShapeConstraints : null, 148 regressionProblemData.VariableRanges) { 146 regressionProblemData.TrainingPartition, regressionProblemData.TestPartition, (regressionProblemData is ShapeConstrainedRegressionProblemData) ? ((ShapeConstrainedRegressionProblemData)regressionProblemData).ShapeConstraints : null, 147 regressionProblemData.Transformations, regressionProblemData.VariableRanges) { 149 148 } 150 149 151 150 public ShapeConstrainedRegressionProblemData(IDataset dataset, IEnumerable<string> allowedInputVariables, string targetVariable, 152 IntRange trainingPartition, IntRange testPartition, 153 IEnumerable<ITransformation> transformations = null, ShapeConstraints sc = null,IntervalCollection variableRanges = null)154 : base(dataset, allowedInputVariables, targetVariable, transformations ?? Enumerable.Empty<ITransformation>()) {151 IntRange trainingPartition, IntRange testPartition, ShapeConstraints sc = null, 152 IEnumerable<ITransformation> transformations = null, IntervalCollection variableRanges = null) 153 : base(dataset, allowedInputVariables, targetVariable, transformations, variableRanges) { 155 154 TrainingPartition.Start = trainingPartition.Start; 156 155 TrainingPartition.End = trainingPartition.End; … … 159 158 if (sc == null) sc = new ShapeConstraints(); 160 159 Parameters.Add(new FixedValueParameter<ShapeConstraints>(ShapeConstraintsParameterName, "Specifies the shape constraints for the regression problem.", (ShapeConstraints)sc.Clone())); 161 if (variableRanges != null) {162 foreach (var entry in variableRanges.GetVariableIntervals())163 VariableRanges.SetInterval(entry.Item1, entry.Item2);164 }165 160 RegisterEventHandlers(); 166 161 }
Note: See TracChangeset
for help on using the changeset viewer.