Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/03/09 15:18:36 (16 years ago)
Author:
gkronber
Message:
  • Added extension method IsAlmost to type double
  • changed evaluation semantics of boolean operations in HL3TreeEvaluator

(#713)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/sources/HeuristicLab.LinearRegression/3.2/LinearRegressionOperator.cs

    r2222 r2226  
    2626using HeuristicLab.Data;
    2727using HeuristicLab.DataAnalysis;
     28using HeuristicLab.Modeling;
    2829using HeuristicLab.GP;
    2930using HeuristicLab.GP.StructureIdentification;
     
    5455      double[] coefficients = CalculateCoefficients(inputMatrix, targetVector);
    5556      IFunctionTree tree = CreateModel(coefficients, allowedColumns.Select(i => dataset.GetVariableName(i)).ToList());
    56      
     57
    5758      scope.AddVariable(new HeuristicLab.Core.Variable(scope.TranslateName("LinearRegressionModel"), new GeneticProgrammingModel(tree)));
    5859      return null;
    59     }
    60 
    61     private bool IsAlmost(double x, double y) {
    62       return Math.Abs(x - y) < 1.0E-12;
    6360    }
    6461
     
    125122      for (int i = 0; i < dataset.Columns; i++) {
    126123        if (i == targetVariable) continue;
    127         if (!IsAlmost(dataset.GetMinimum(i, start, end), 0.0) ||
    128             !IsAlmost(dataset.GetMaximum(i, start, end), 0.0))
     124        if (!dataset.GetMinimum(i, start, end).IsAlmost(0.0) ||
     125            !dataset.GetMaximum(i, start, end).IsAlmost(0.0))
    129126          allowedColumns.Add(i);
    130127      }
Note: See TracChangeset for help on using the changeset viewer.