Free cookie consent management tool by TermsFeed Policy Generator

Changeset 4225


Ignore:
Timestamp:
08/16/10 10:03:11 (14 years ago)
Author:
gkronber
Message:

Minor adaption of existing symbolic regression classes. #1142.

Location:
branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Analyzers/FixedValidationBestScaledSymbolicRegressionSolutionAnalyzer.cs

    r4202 r4225  
    152152      get { return (ILookupParameter<DoubleValue>)Parameters[BestKnownQualityParameterName]; }
    153153    }
     154    public ILookupParameter<DoubleValue> CurrentBestValidationQualityParameter {
     155      get { return (ILookupParameter<DoubleValue>)Parameters[CurrentBestValidationQualityParameterName]; }
     156    }
     157
    154158    public ILookupParameter<DataTable> VariableFrequenciesParameter {
    155159      get { return (ILookupParameter<DataTable>)Parameters[VariableFrequenciesParameterName]; }
     
    225229      Parameters.Add(new LookupParameter<ResultCollection>(ResultsParameterName, "The result collection where the best symbolic regression solution should be stored."));
    226230      Parameters.Add(new LookupParameter<DoubleValue>(BestKnownQualityParameterName, "The best known (validation) quality achieved on the data set."));
     231      Parameters.Add(new LookupParameter<DoubleValue>(CurrentBestValidationQualityParameterName, "The quality of the best solution (on the validation set) of the current generation."));
    227232      Parameters.Add(new LookupParameter<DataTable>(VariableFrequenciesParameterName, "The variable frequencies table to use for the calculation of variable impacts"));
    228233    }
     
    287292        IEnumerable<int> trainingRows = Enumerable.Range(trainingStart, trainingEnd - trainingStart);
    288293        IEnumerable<double> originalValues = ProblemData.Dataset.GetEnumeratedVariableValues(targetVariable, trainingRows);
    289         IEnumerable<double> estimatedValues =
    290           GetBoundedValues(SymbolicExpressionTreeInterpreter.GetSymbolicExpressionTreeValues(bestTree, ProblemData.Dataset, trainingRows),
    291             lowerEstimationLimit, upperEstimationLimit);
    292 
     294        IEnumerable<double> estimatedValues = SymbolicExpressionTreeInterpreter.GetSymbolicExpressionTreeValues(bestTree, ProblemData.Dataset, trainingRows);
    293295
    294296        SymbolicRegressionScaledMeanSquaredErrorEvaluator.CalculateScalingParameters(originalValues, estimatedValues, out beta, out alpha);
     
    308310      }
    309311
     312      CurrentBestValidationQualityParameter.ActualValue = new DoubleValue(bestQuality);
    310313
    311314      if (!Results.ContainsKey(BestSolutionQualityValuesParameterName)) {
     
    321324      AddValue(validationValues, bestQuality, CurrentBestValidationQualityParameterName, CurrentBestValidationQualityParameterName);
    322325      return base.Apply();
    323     }
    324 
    325     private IEnumerable<double> GetBoundedValues(IEnumerable<double> values, double lowerEstimationLimit, double upperEstimationLimit) {
    326       foreach (double v in values) {
    327         if (double.IsNaN(v)) yield return upperEstimationLimit;
    328         else yield return Math.Min(upperEstimationLimit, Math.Max(lowerEstimationLimit, v));
    329       }
    330326    }
    331327
  • branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Evaluators/SymbolicRegressionPearsonsRSquaredEvaluator.cs

    r4202 r4225  
    3939
    4040    public override double Evaluate(ISymbolicExpressionTreeInterpreter interpreter, SymbolicExpressionTree solution, double lowerEstimationLimit, double upperEstimationLimit, Dataset dataset, string targetVariable, IEnumerable<int> rows) {
    41       double mse = Calculate(interpreter, solution, lowerEstimationLimit, upperEstimationLimit, dataset, targetVariable, rows);
    42       return mse;
     41      double r2 = Calculate(interpreter, solution, lowerEstimationLimit, upperEstimationLimit, dataset, targetVariable, rows);
     42      return r2;
    4343    }
    4444
  • branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/SymbolicRegressionProblemBase.cs

    r4195 r4225  
    154154      : base() {
    155155      SymbolicExpressionTreeCreator creator = new ProbabilisticTreeCreator();
    156       var grammar = new BasicExpressionGrammar();
     156      var grammar = new FullFunctionalExpressionGrammar();
    157157      var globalGrammar = new GlobalSymbolicExpressionGrammar(grammar);
    158158      var interpreter = new SimpleArithmeticExpressionInterpreter();
Note: See TracChangeset for help on using the changeset viewer.