Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/14/10 10:45:41 (14 years ago)
Author:
mkommend
Message:

implemented first version of partially evaluation of samples (ticket #1082)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/SymbolicRegressionScaledMeanSquaredErrorEvaluator.cs

    r4027 r4034  
    6666    }
    6767
    68     protected override double Evaluate(ISymbolicExpressionTreeInterpreter interpreter, SymbolicExpressionTree solution, Dataset dataset, StringValue targetVariable, IntValue samplesStart, IntValue samplesEnd) {
     68    protected override double Evaluate(ISymbolicExpressionTreeInterpreter interpreter, SymbolicExpressionTree solution, Dataset dataset, StringValue targetVariable, IEnumerable<int> rows) {
    6969      double alpha, beta;
    70       double mse = Calculate(interpreter, solution, LowerEstimationLimit.Value, UpperEstimationLimit.Value, dataset, targetVariable.Value, samplesStart.Value, samplesEnd.Value, out beta, out alpha);
     70      double mse = Calculate(interpreter, solution, LowerEstimationLimit.Value, UpperEstimationLimit.Value, dataset, targetVariable.Value, rows, out beta, out alpha);
    7171      AlphaParameter.ActualValue = new DoubleValue(alpha);
    7272      BetaParameter.ActualValue = new DoubleValue(beta);
     
    7474    }
    7575
    76     public static double Calculate(ISymbolicExpressionTreeInterpreter interpreter, SymbolicExpressionTree solution, double lowerEstimationLimit, double upperEstimationLimit, Dataset dataset, string targetVariable, int start, int end, out double beta, out double alpha) {
    77       IEnumerable<double> originalValues = dataset.GetEnumeratedVariableValues(targetVariable, start, end);
    78       IEnumerable<double> estimatedValues = interpreter.GetSymbolicExpressionTreeValues(solution, dataset, Enumerable.Range(start, end - start));
     76    public static double Calculate(ISymbolicExpressionTreeInterpreter interpreter, SymbolicExpressionTree solution, double lowerEstimationLimit, double upperEstimationLimit, Dataset dataset, string targetVariable, IEnumerable<int> rows, out double beta, out double alpha) {
     77      IEnumerable<double> originalValues = dataset.GetEnumeratedVariableValues(targetVariable,rows);
     78      IEnumerable<double> estimatedValues = interpreter.GetSymbolicExpressionTreeValues(solution, dataset, rows);
    7979      CalculateScalingParameters(originalValues, estimatedValues, out beta, out alpha);
    8080
    81       return CalculateWithScaling(interpreter, solution, lowerEstimationLimit, upperEstimationLimit, dataset, targetVariable, start, end, beta, alpha);
     81      return CalculateWithScaling(interpreter, solution, lowerEstimationLimit, upperEstimationLimit, dataset, targetVariable, rows, beta, alpha);
    8282    }
    8383
    84     public static double CalculateWithScaling(ISymbolicExpressionTreeInterpreter interpreter, SymbolicExpressionTree solution, double lowerEstimationLimit, double upperEstimationLimit, Dataset dataset, string targetVariable, int start, int end, double beta, double alpha) {
    85       IEnumerable<double> estimatedValues = interpreter.GetSymbolicExpressionTreeValues(solution, dataset, Enumerable.Range(start, end - start));
    86       IEnumerable<double> originalValues = dataset.GetEnumeratedVariableValues(targetVariable, start, end);
     84    public static double CalculateWithScaling(ISymbolicExpressionTreeInterpreter interpreter, SymbolicExpressionTree solution, double lowerEstimationLimit, double upperEstimationLimit, Dataset dataset, string targetVariable, IEnumerable<int> rows, double beta, double alpha) {
     85      IEnumerable<double> estimatedValues = interpreter.GetSymbolicExpressionTreeValues(solution, dataset, rows);
     86      IEnumerable<double> originalValues = dataset.GetEnumeratedVariableValues(targetVariable, rows);
    8787      IEnumerator<double> originalEnumerator = originalValues.GetEnumerator();
    8888      IEnumerator<double> estimatedEnumerator = estimatedValues.GetEnumerator();
Note: See TracChangeset for help on using the changeset viewer.