Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/01/10 21:06:40 (14 years ago)
Author:
gkronber
Message:

Implemented basic framework for symbolic regression problems for HL 3.3. #938 (Data types and operators for regression problems)

Location:
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Evaluators
Files:
1 added
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Evaluators/SimpleMSEEvaluator.cs

    r3246 r3253  
    1 using System;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
     22using System;
    223using System.Collections.Generic;
    324using System.Linq;
     
    526using HeuristicLab.Core;
    627using HeuristicLab.Data;
    7 using HeuristicLab.DataAnalysis;
    828
    9 namespace HeuristicLab.Modeling {
    10   public class SimpleMSEEvaluator : SimpleEvaluatorBase {
     29namespace HeuristicLab.Problems.DataAnalysis.Evaluators {
     30  public class SimpleMSEEvaluator : SimpleEvaluator {
    1131
    12     public override string OutputVariableName {
    13       get {
    14         return "MSE";
    15       }
    16     }
    17     public override double Evaluate(double[,] values) {
    18       try {
    19         return Calculate(values);
    20       }
    21       catch (ArgumentException) {
    22         return double.PositiveInfinity;
    23       }
     32    public SimpleMSEEvaluator()
     33      : base() {
     34      QualityParameter.ActualName = "MeanSquaredError";
    2435    }
    2536
    26     public static double Calculate(double[,] values) {
     37    protected override double Apply(DoubleMatrix values) {
     38      return Calculate(values);
     39    }
     40
     41    public static double Calculate(DoubleMatrix values) {
    2742      double sse = 0;
    2843      double cnt = 0;
    29       for (int i = 0; i < values.GetLength(0); i++) {
     44      for (int i = 0; i < values.Rows; i++) {
    3045        double estimated = values[i, ESTIMATION_INDEX];
    3146        double target = values[i, ORIGINAL_INDEX];
Note: See TracChangeset for help on using the changeset viewer.