Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/17/16 15:42:19 (8 years ago)
Author:
gkronber
Message:

#2650: merged r14457:14494 from trunk to branch (resolving conflicts)

Location:
branches/symbreg-factors-2650
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • branches/symbreg-factors-2650

  • branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis

  • branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionSolutionVariableImpactsCalculator.cs

    r14351 r14498  
    122122      }
    123123
    124 
    125124      var impacts = new Dictionary<string, double>();
    126125      var modifiableDataset = ((Dataset)dataset).ToModifiable();
    127126
     127      var inputvariables = new HashSet<string>(problemData.AllowedInputVariables.Union(solution.Model.VariablesUsedForPrediction));
     128      var allowedInputVariables = dataset.VariableNames.Where(v => inputvariables.Contains(v)).ToList();
     129
    128130      // calculate impacts for double variables
    129       foreach (var inputVariable in problemData.AllowedInputVariables.Where(problemData.Dataset.VariableHasType<double>)) {
     131      foreach (var inputVariable in allowedInputVariables.Where(problemData.Dataset.VariableHasType<double>)) {
    130132        var newEstimates = EvaluateModelWithReplacedVariable(solution.Model, inputVariable, modifiableDataset, rows, replacementMethod);
    131133        var newR2 = OnlinePearsonsRCalculator.Calculate(targetValues, newEstimates, out error);
     
    137139      }
    138140      // calculate impacts for factor variables
    139       foreach (var inputVariable in problemData.AllowedInputVariables.Where(problemData.Dataset.VariableHasType<string>)) {
     141      foreach (var inputVariable in allowedInputVariables.Where(problemData.Dataset.VariableHasType<string>)) {
    140142        var smallestImpact = double.PositiveInfinity;
    141143        foreach (var repl in problemData.Dataset.GetStringValues(inputVariable, rows).Distinct()) {
  • branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/ClassificationPerformanceMeasuresCalculator.cs

    r14399 r14498  
    3333    }
    3434
    35     protected ClassificationPerformanceMeasuresCalculator(ClassificationPerformanceMeasuresCalculator original, Cloner cloner) {
     35    protected ClassificationPerformanceMeasuresCalculator(ClassificationPerformanceMeasuresCalculator original, Cloner cloner)
     36      : base(original, cloner) {
    3637      positiveClassName = original.positiveClassName;
    3738      positiveClassValue = original.positiveClassValue;
     
    4142      falseNegativeCount = original.falseNegativeCount;
    4243      errorState = original.errorState;
     44    }
     45    public override IDeepCloneable Clone(Cloner cloner) {
     46      return new ClassificationPerformanceMeasuresCalculator(this, cloner);
    4347    }
    4448
     
    147151      errorState = ErrorState;
    148152    }
    149 
    150     public override IDeepCloneable Clone(Cloner cloner) {
    151       return new ClassificationPerformanceMeasuresCalculator(this, cloner);
    152     }
    153153  }
    154154}
  • branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineBoundedMeanSquaredErrorCalculator.cs

    r14399 r14498  
    4545    }
    4646
    47     protected OnlineBoundedMeanSquaredErrorCalculator(OnlineBoundedMeanSquaredErrorCalculator original, Cloner cloner) {
     47    protected OnlineBoundedMeanSquaredErrorCalculator(OnlineBoundedMeanSquaredErrorCalculator original, Cloner cloner)
     48      : base(original, cloner) {
    4849      LowerBound = original.LowerBound;
    4950      UpperBound = original.UpperBound;
     
    5152      errorSum = original.errorSum;
    5253      errorState = original.ErrorState;
     54    }
     55    public override IDeepCloneable Clone(Cloner cloner) {
     56      return new OnlineBoundedMeanSquaredErrorCalculator(this, cloner);
    5357    }
    5458
     
    105109      }
    106110    }
    107 
    108     // IDeepCloneable interface members
    109     public override IDeepCloneable Clone(Cloner cloner) {
    110       return new OnlineBoundedMeanSquaredErrorCalculator(this, cloner);
    111     }
    112111  }
    113112}
  • branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineCovarianceCalculator.cs

    r14399 r14498  
    3939    }
    4040
    41     protected OnlineCovarianceCalculator(OnlineCovarianceCalculator other, Cloner cloner) {
    42       Cn = other.Cn;
    43       xMean = other.xMean;
    44       yMean = other.yMean;
    45       n = other.n;
    46       errorState = other.errorState;
     41    protected OnlineCovarianceCalculator(OnlineCovarianceCalculator original, Cloner cloner)
     42      : base(original, cloner) {
     43      Cn = original.Cn;
     44      xMean = original.xMean;
     45      yMean = original.yMean;
     46      n = original.n;
     47      errorState = original.errorState;
     48    }
     49
     50    public override IDeepCloneable Clone(Cloner cloner) {
     51      return new OnlineCovarianceCalculator(this, cloner);
    4752    }
    4853
     
    103108      }
    104109    }
    105 
    106     public override IDeepCloneable Clone(Cloner cloner) {
    107       return new OnlineCovarianceCalculator(this, cloner);
    108     }
    109110  }
    110111}
  • branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineDirectionalSymmetryCalculator.cs

    r14399 r14498  
    4141    }
    4242
    43     protected OnlineDirectionalSymmetryCalculator(OnlineDirectionalSymmetryCalculator other, Cloner cloner = null) {
    44       n = other.n;
    45       nCorrect = other.nCorrect;
    46       errorState = other.errorState;
     43    protected OnlineDirectionalSymmetryCalculator(OnlineDirectionalSymmetryCalculator original, Cloner cloner = null)
     44      : base(original, cloner) {
     45      n = original.n;
     46      nCorrect = original.nCorrect;
     47      errorState = original.errorState;
     48    }
     49
     50    public override IDeepCloneable Clone(Cloner cloner) {
     51      return new OnlineDirectionalSymmetryCalculator(this, cloner);
    4752    }
    4853
     
    122127      }
    123128    }
    124 
    125     public override IDeepCloneable Clone(Cloner cloner) {
    126       return new OnlineDirectionalSymmetryCalculator(this, cloner);
    127     }
    128129  }
    129130}
  • branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineLinearScalingParameterCalculator.cs

    r14399 r14498  
    5555    }
    5656
    57     private OnlineMeanAndVarianceCalculator targetMeanCalculator;
    58     private OnlineMeanAndVarianceCalculator originalMeanAndVarianceCalculator;
    59     private OnlineCovarianceCalculator originalTargetCovarianceCalculator;
     57    private readonly OnlineMeanAndVarianceCalculator targetMeanCalculator;
     58    private readonly OnlineMeanAndVarianceCalculator originalMeanAndVarianceCalculator;
     59    private readonly OnlineCovarianceCalculator originalTargetCovarianceCalculator;
    6060
    6161    public OnlineLinearScalingParameterCalculator() {
     
    6666    }
    6767
    68     protected OnlineLinearScalingParameterCalculator(OnlineLinearScalingParameterCalculator other, Cloner cloner) {
    69       targetMeanCalculator = (OnlineMeanAndVarianceCalculator)other.targetMeanCalculator.Clone(cloner);
    70       originalMeanAndVarianceCalculator = (OnlineMeanAndVarianceCalculator)other.originalMeanAndVarianceCalculator.Clone(cloner);
    71       originalTargetCovarianceCalculator = (OnlineCovarianceCalculator)other.originalTargetCovarianceCalculator.Clone(cloner);
     68    protected OnlineLinearScalingParameterCalculator(OnlineLinearScalingParameterCalculator original, Cloner cloner)
     69      : base(original, cloner) {
     70      targetMeanCalculator = cloner.Clone(original.targetMeanCalculator);
     71      originalMeanAndVarianceCalculator = cloner.Clone(original.originalMeanAndVarianceCalculator);
     72      originalTargetCovarianceCalculator = cloner.Clone(original.originalTargetCovarianceCalculator);
    7273      // do not reset the calculators here
     74    }
     75    public override IDeepCloneable Clone(Cloner cloner) {
     76      return new OnlineLinearScalingParameterCalculator(this, cloner);
    7377    }
    7478
     
    125129      }
    126130    }
    127 
    128     public override IDeepCloneable Clone(Cloner cloner) {
    129       return new OnlineLinearScalingParameterCalculator(this, cloner);
    130     }
    131131  }
    132132}
  • branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineMaxAbsoluteErrorCalculator.cs

    r14399 r14498  
    3939    }
    4040
    41     protected OnlineMaxAbsoluteErrorCalculator(OnlineMaxAbsoluteErrorCalculator other, Cloner cloner = null) {
    42       mae = other.mae;
    43       n = other.n;
    44       errorState = other.errorState;
     41    protected OnlineMaxAbsoluteErrorCalculator(OnlineMaxAbsoluteErrorCalculator original, Cloner cloner = null)
     42      : base(original, cloner) {
     43      mae = original.mae;
     44      n = original.n;
     45      errorState = original.errorState;
     46    }
     47    public override IDeepCloneable Clone(Cloner cloner) {
     48      return new OnlineMaxAbsoluteErrorCalculator(this, cloner);
    4549    }
    4650
     
    9599      }
    96100    }
    97 
    98     public override IDeepCloneable Clone(Cloner cloner) {
    99       return new OnlineMaxAbsoluteErrorCalculator(this, cloner);
    100     }
    101101  }
    102102}
  • branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineMeanAbsoluteErrorCalculator.cs

    r14399 r14498  
    3939    }
    4040
    41     protected OnlineMeanAbsoluteErrorCalculator(OnlineMeanAbsoluteErrorCalculator other, Cloner cloner = null) {
    42       sae = other.sae;
    43       n = other.n;
    44       errorState = other.errorState;
     41    protected OnlineMeanAbsoluteErrorCalculator(OnlineMeanAbsoluteErrorCalculator original, Cloner cloner = null)
     42      : base(original, cloner) {
     43      sae = original.sae;
     44      n = original.n;
     45      errorState = original.errorState;
     46    }
     47    public override IDeepCloneable Clone(Cloner cloner) {
     48      return new OnlineMeanAbsoluteErrorCalculator(this, cloner);
    4549    }
    4650
     
    9498      }
    9599    }
    96 
    97     public override IDeepCloneable Clone(Cloner cloner) {
    98       return new OnlineMeanAbsoluteErrorCalculator(this, cloner);
    99     }
    100100  }
    101101}
  • branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineMeanAbsolutePercentageErrorCalculator.cs

    r14399 r14498  
    3939    }
    4040
    41     protected OnlineMeanAbsolutePercentageErrorCalculator(OnlineMeanAbsolutePercentageErrorCalculator other, Cloner cloner = null) {
    42       sre = other.sre;
    43       n = other.n;
    44       errorState = other.errorState;
     41    protected OnlineMeanAbsolutePercentageErrorCalculator(OnlineMeanAbsolutePercentageErrorCalculator original, Cloner cloner = null)
     42      : base(original, cloner) {
     43      sre = original.sre;
     44      n = original.n;
     45      errorState = original.errorState;
     46    }
     47
     48    public override IDeepCloneable Clone(Cloner cloner) {
     49      return new OnlineMeanAbsolutePercentageErrorCalculator(this, cloner);
    4550    }
    4651
     
    95100      }
    96101    }
    97 
    98     public override IDeepCloneable Clone(Cloner cloner) {
    99       return new OnlineMeanAbsolutePercentageErrorCalculator(this, cloner);
    100     }
    101102  }
    102103}
  • branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineMeanAndVarianceCalculator.cs

    r14399 r14498  
    6767    }
    6868
    69     protected OnlineMeanAndVarianceCalculator(OnlineMeanAndVarianceCalculator other, Cloner cloner = null) {
    70       m_oldS = other.m_oldS;
    71       m_oldM = other.m_oldM;
    72       m_newS = other.m_newS;
    73       m_newM = other.m_newM;
    74       n = other.n;
    75       errorState = other.errorState;
    76       varianceErrorState = other.varianceErrorState;
     69    protected OnlineMeanAndVarianceCalculator(OnlineMeanAndVarianceCalculator original, Cloner cloner = null)
     70      : base(original, cloner) {
     71      m_oldS = original.m_oldS;
     72      m_oldM = original.m_oldM;
     73      m_newS = original.m_newS;
     74      m_newM = original.m_newM;
     75      n = original.n;
     76      errorState = original.errorState;
     77      varianceErrorState = original.varianceErrorState;
     78    }
     79    public override IDeepCloneable Clone(Cloner cloner) {
     80      return new OnlineMeanAndVarianceCalculator(this, cloner);
    7781    }
    7882
     
    117121      varianceErrorState = meanAndVarianceCalculator.VarianceErrorState;
    118122    }
    119 
    120     public override IDeepCloneable Clone(Cloner cloner) {
    121       return new OnlineMeanAndVarianceCalculator(this, cloner);
    122     }
    123123  }
    124124}
  • branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineMeanErrorCalculator.cs

    r14399 r14498  
    3737    }
    3838
    39     protected OnlineMeanErrorCalculator(OnlineMeanErrorCalculator other, Cloner cloner) {
    40       meanAndVarianceCalculator = (OnlineMeanAndVarianceCalculator)other.meanAndVarianceCalculator.Clone(cloner);
     39    protected OnlineMeanErrorCalculator(OnlineMeanErrorCalculator original, Cloner cloner)
     40      : base(original, cloner) {
     41      meanAndVarianceCalculator = cloner.Clone(original.meanAndVarianceCalculator);
     42    }
     43    public override IDeepCloneable Clone(Cloner cloner) {
     44      return new OnlineMeanErrorCalculator(this, cloner);
    4145    }
    4246
     
    7983      }
    8084    }
    81 
    82     public override IDeepCloneable Clone(Cloner cloner) {
    83       return new OnlineMeanErrorCalculator(this, cloner);
    84     }
    8585  }
    8686}
  • branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineMeanSquaredErrorCalculator.cs

    r14399 r14498  
    3939    }
    4040
    41     protected OnlineMeanSquaredErrorCalculator(OnlineMeanSquaredErrorCalculator other, Cloner cloner = null) {
    42       sse = other.sse;
    43       n = other.n;
    44       errorState = other.errorState;
     41    protected OnlineMeanSquaredErrorCalculator(OnlineMeanSquaredErrorCalculator original, Cloner cloner)
     42      : base(original, cloner) {
     43      sse = original.sse;
     44      n = original.n;
     45      errorState = original.errorState;
     46    }
     47    public override IDeepCloneable Clone(Cloner cloner) {
     48      return new OnlineMeanSquaredErrorCalculator(this, cloner);
    4549    }
    4650
     
    9498      }
    9599    }
    96 
    97     public override IDeepCloneable Clone(Cloner cloner) {
    98       return new OnlineMeanSquaredErrorCalculator(this, cloner);
    99     }
    100100  }
    101101}
  • branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineNormalizedMeanSquaredErrorCalculator.cs

    r14399 r14498  
    4343    }
    4444
    45     protected OnlineNormalizedMeanSquaredErrorCalculator(OnlineNormalizedMeanSquaredErrorCalculator other, Cloner cloner) {
    46       meanSquaredErrorCalculator = (OnlineMeanAndVarianceCalculator)other.meanSquaredErrorCalculator.Clone(cloner);
    47       originalVarianceCalculator = (OnlineMeanAndVarianceCalculator)other.originalVarianceCalculator.Clone(cloner);
     45    protected OnlineNormalizedMeanSquaredErrorCalculator(OnlineNormalizedMeanSquaredErrorCalculator original, Cloner cloner)
     46      : base(original, cloner) {
     47      meanSquaredErrorCalculator = cloner.Clone(original.meanSquaredErrorCalculator);
     48      originalVarianceCalculator = cloner.Clone(original.originalVarianceCalculator);
     49    }
     50    public override IDeepCloneable Clone(Cloner cloner) {
     51      return new OnlineNormalizedMeanSquaredErrorCalculator(this, cloner);
    4852    }
    4953
     
    99103    }
    100104
    101     public override IDeepCloneable Clone(Cloner cloner) {
    102       return new OnlineNormalizedMeanSquaredErrorCalculator(this, cloner);
    103     }
     105
    104106  }
    105107}
  • branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlinePearsonsRCalculator.cs

    r14399 r14498  
    4747    public OnlinePearsonsRCalculator() { }
    4848
    49     protected OnlinePearsonsRCalculator(OnlinePearsonsRCalculator other, Cloner cloner) {
    50       covCalculator = (OnlineCovarianceCalculator)other.covCalculator.Clone(cloner);
    51       sxCalculator = (OnlineMeanAndVarianceCalculator)other.sxCalculator.Clone(cloner);
    52       syCalculator = (OnlineMeanAndVarianceCalculator)other.syCalculator.Clone(cloner);
     49    protected OnlinePearsonsRCalculator(OnlinePearsonsRCalculator original, Cloner cloner)
     50      : base(original, cloner) {
     51      covCalculator = cloner.Clone(original.covCalculator);
     52      sxCalculator = cloner.Clone(original.sxCalculator);
     53      syCalculator = cloner.Clone(original.syCalculator);
     54    }
     55    public override IDeepCloneable Clone(Cloner cloner) {
     56      return new OnlinePearsonsRCalculator(this, cloner);
    5357    }
    5458
     
    97101      }
    98102    }
    99 
    100     public override IDeepCloneable Clone(Cloner cloner) {
    101       return new OnlinePearsonsRCalculator(this, cloner);
    102     }
    103103  }
    104104}
  • branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlinePearsonsRSquaredCalculator.cs

    r14399 r14498  
    3838    public OnlinePearsonsRSquaredCalculator() { }
    3939
    40     protected OnlinePearsonsRSquaredCalculator(OnlinePearsonsRSquaredCalculator other, Cloner cloner) {
    41       this.rCalculator = (OnlinePearsonsRCalculator)other.rCalculator.Clone(cloner);
     40    protected OnlinePearsonsRSquaredCalculator(OnlinePearsonsRSquaredCalculator original, Cloner cloner)
     41      : base(original, cloner) {
     42      rCalculator = cloner.Clone(original.rCalculator);
     43    }
     44    public override IDeepCloneable Clone(Cloner cloner) {
     45      return new OnlinePearsonsRSquaredCalculator(this, cloner);
    4246    }
    4347
     
    6468    }
    6569
    66     public override IDeepCloneable Clone(Cloner cloner) {
    67       return new OnlinePearsonsRSquaredCalculator(this, cloner);
    68     }
     70
    6971  }
    7072}
  • branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineTheilsUStatisticCalculator.cs

    r14399 r14498  
    2626namespace HeuristicLab.Problems.DataAnalysis {
    2727  public class OnlineTheilsUStatisticCalculator : DeepCloneable, IOnlineTimeSeriesCalculator {
    28     private OnlineMeanAndVarianceCalculator squaredErrorMeanCalculator;
    29     private OnlineMeanAndVarianceCalculator unbiasedEstimatorMeanCalculator;
     28    private readonly OnlineMeanAndVarianceCalculator squaredErrorMeanCalculator;
     29    private readonly OnlineMeanAndVarianceCalculator unbiasedEstimatorMeanCalculator;
    3030
    3131    public double TheilsUStatistic {
     
    4646    }
    4747
    48     protected OnlineTheilsUStatisticCalculator(OnlineTheilsUStatisticCalculator other, Cloner cloner) {
    49       squaredErrorMeanCalculator = (OnlineMeanAndVarianceCalculator)other.squaredErrorMeanCalculator.Clone(cloner);
    50       unbiasedEstimatorMeanCalculator = (OnlineMeanAndVarianceCalculator)other.unbiasedEstimatorMeanCalculator.Clone(cloner);
     48    protected OnlineTheilsUStatisticCalculator(OnlineTheilsUStatisticCalculator original, Cloner cloner)
     49      : base(original, cloner) {
     50      squaredErrorMeanCalculator = cloner.Clone(original.squaredErrorMeanCalculator);
     51      unbiasedEstimatorMeanCalculator = cloner.Clone(original.unbiasedEstimatorMeanCalculator);
     52    }
     53    public override IDeepCloneable Clone(Cloner cloner) {
     54      return new OnlineTheilsUStatisticCalculator(this, cloner);
    5155    }
    5256
     
    131135      }
    132136    }
    133 
    134     public override IDeepCloneable Clone(Cloner cloner) {
    135       return new OnlineTheilsUStatisticCalculator(this, cloner);
    136     }
    137137  }
    138138}
  • branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineWeightedDirectionalSymmetryCalculator.cs

    r14399 r14498  
    4242    }
    4343
    44     protected OnlineWeightedDirectionalSymmetryCalculator(OnlineWeightedDirectionalSymmetryCalculator other, Cloner cloner) {
    45       n = other.n;
    46       correctSum = other.correctSum;
    47       incorrectSum = other.incorrectSum;
    48       errorState = other.errorState;
     44    protected OnlineWeightedDirectionalSymmetryCalculator(OnlineWeightedDirectionalSymmetryCalculator original, Cloner cloner)
     45      : base(original, cloner) {
     46      n = original.n;
     47      correctSum = original.correctSum;
     48      incorrectSum = original.incorrectSum;
     49      errorState = original.errorState;
     50    }
     51
     52    public override IDeepCloneable Clone(Cloner cloner) {
     53      return new OnlineWeightedDirectionalSymmetryCalculator(this, cloner);
    4954    }
    5055
     
    125130      }
    126131    }
    127 
    128     public override IDeepCloneable Clone(Cloner cloner) {
    129       return new OnlineWeightedDirectionalSymmetryCalculator(this, cloner);
    130     }
    131132  }
    132133}
Note: See TracChangeset for help on using the changeset viewer.