Free cookie consent management tool by TermsFeed Policy Generator

Changeset 18141


Ignore:
Timestamp:
12/16/21 10:23:29 (3 years ago)
Author:
chaider
Message:

#3140 merged branch into trunk

Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/HeuristicLab.Problems.DataAnalysis

  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic

  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TreeMatching/SymbolicExpressionTreeBottomUpSimilarityCalculator.cs

    r18132 r18141  
    4141    protected override bool IsCommutative { get { return true; } }
    4242
    43     public bool MatchParameterValues { get; set; }
     43    public bool MatchNumericValues { get; set; }
    4444    public bool MatchVariableWeights { get; set; }
    4545
     
    7474
    7575    public static NodeMap ComputeBottomUpMapping(ISymbolicExpressionTreeNode n1, ISymbolicExpressionTreeNode n2, bool strict = false) {
    76       var calculator = new SymbolicExpressionTreeBottomUpSimilarityCalculator { MatchParameterValues = strict, MatchVariableWeights = strict };
     76      var calculator = new SymbolicExpressionTreeBottomUpSimilarityCalculator { MatchNumericValues = strict, MatchVariableWeights = strict };
    7777      return calculator.ComputeBottomUpMapping(n1, n2);
    7878    }
     
    211211
    212212      if (node is INumericTreeNode numNode)
    213         return MatchParameterValues ? numNode.Value.ToString(CultureInfo.InvariantCulture) : "Numeric";
     213        return MatchNumericValues ? numNode.Value.ToString(CultureInfo.InvariantCulture) : "Numeric";
    214214
    215215      if (node is VariableTreeNode variable)
  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TreeMatching/SymbolicExpressionTreeNodeEqualityComparer.cs

    r18132 r18141  
    3333    protected SymbolicExpressionTreeNodeEqualityComparer(SymbolicExpressionTreeNodeEqualityComparer original, Cloner cloner)
    3434      : base(original, cloner) {
    35       matchParameterValues = original.matchParameterValues;
     35      matchNumericValues = original.matchNumericValues;
    3636      matchVariableNames = original.matchVariableNames;
    3737      matchVariableWeights = original.matchVariableWeights;
     
    4141    // more flexible matching criteria
    4242    [Storable]
    43     private bool matchParameterValues;
     43    private bool matchNumericValues;
    4444    public bool MatchParameterValues {
    45       get { return matchParameterValues; }
    46       set { matchParameterValues = value; }
     45      get { return matchNumericValues; }
     46      set { matchNumericValues = value; }
    4747    }
    4848
     
    6666
    6767    public SymbolicExpressionTreeNodeEqualityComparer() {
    68       matchParameterValues = true;
     68      matchNumericValues = true;
    6969      matchVariableNames = true;
    7070      matchVariableWeights = true;
  • trunk/HeuristicLab.Problems.DataAnalysis/3.4

  • trunk/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/DataAnalysisProblemData.cs

    r18034 r18141  
    189189      if (variableRanges == null) {
    190190        variableRanges = Dataset.GetVariableRanges();
    191       }
     191      }else {
     192        foreach (var entry in variableRanges.GetVariableIntervals())
     193          VariableRanges.SetInterval(entry.Item1, entry.Item2);
     194      }
     195
    192196      Parameters.Add(new FixedValueParameter<IntervalCollection>(VariableRangesParameterName, variableRanges));
    193197
  • trunk/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionProblemData.cs

    r18034 r18141  
    158158
    159159    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) {
    163162      var variables = InputVariables.Select(x => x.AsReadOnly()).ToList();
    164163      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     
    169165    }
    170166    private void RegisterParameterEvents() {
  • trunk/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/ShapeConstrainedRegressionProblemData.cs

    r18111 r18141  
    144144    public ShapeConstrainedRegressionProblemData(IRegressionProblemData regressionProblemData)
    145145      : 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) {
    149148    }
    150149
    151150    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) {
    155154      TrainingPartition.Start = trainingPartition.Start;
    156155      TrainingPartition.End = trainingPartition.End;
     
    159158      if (sc == null) sc = new ShapeConstraints();
    160159      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       }
    165160      RegisterEventHandlers();
    166161    }
Note: See TracChangeset for help on using the changeset viewer.