Changeset 3253 for trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Evaluators/SimpleMSEEvaluator.cs
- Timestamp:
- 04/01/10 21:06:40 (14 years ago)
- 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 22 using System; 2 23 using System.Collections.Generic; 3 24 using System.Linq; … … 5 26 using HeuristicLab.Core; 6 27 using HeuristicLab.Data; 7 using HeuristicLab.DataAnalysis;8 28 9 namespace HeuristicLab. Modeling{10 public class SimpleMSEEvaluator : SimpleEvaluator Base{29 namespace HeuristicLab.Problems.DataAnalysis.Evaluators { 30 public class SimpleMSEEvaluator : SimpleEvaluator { 11 31 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"; 24 35 } 25 36 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) { 27 42 double sse = 0; 28 43 double cnt = 0; 29 for (int i = 0; i < values. GetLength(0); i++) {44 for (int i = 0; i < values.Rows; i++) { 30 45 double estimated = values[i, ESTIMATION_INDEX]; 31 46 double target = values[i, ORIGINAL_INDEX];
Note: See TracChangeset
for help on using the changeset viewer.