- Timestamp:
- 05/20/09 12:52:52 (15 years ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Modeling/3.2/SimpleR2Evaluator.cs
r1854 r1869 7 7 using HeuristicLab.DataAnalysis; 8 8 9 namespace HeuristicLab. SupportVectorMachines{10 public class SimpleR2Evaluator : OperatorBase {9 namespace HeuristicLab.Modeling { 10 public class SimpleR2Evaluator : OperatorBase { 11 11 12 12 public SimpleR2Evaluator() 13 13 : base() { 14 AddVariableInfo(new VariableInfo("Values", "Target vs predicted values", typeof( ItemList), VariableKind.In));14 AddVariableInfo(new VariableInfo("Values", "Target vs predicted values", typeof(DoubleMatrixData), VariableKind.In)); 15 15 AddVariableInfo(new VariableInfo("R2", "Coefficient of determination", typeof(DoubleData), VariableKind.New | VariableKind.Out)); 16 16 } 17 17 18 18 public override IOperation Apply(IScope scope) { 19 ItemList values = GetVariableValue<ItemList>("Values", scope, true);19 DoubleMatrixData values = GetVariableValue<DoubleMatrixData>("Values", scope, true); 20 20 21 21 double targetMean = 0; 22 22 double sse = 0; 23 23 double cnt = 0; 24 for each (ItemList row in values) {25 double estimated = ((DoubleData)row[0]).Data;26 double target = ((DoubleData)row[1]).Data;24 for (int i = 0; i < values.Data.GetLength(0); i++) { 25 double estimated = values.Data[i, 0]; 26 double target = values.Data[i, 1]; 27 27 if (!double.IsNaN(estimated) && !double.IsInfinity(estimated) && 28 28 !double.IsNaN(target) && !double.IsInfinity(target)) { … … 36 36 37 37 double targetDeviationTotalSumOfSquares = 0; 38 for each (ItemList row in values) {39 double target = ((DoubleData)row[1]).Data;38 for (int i = 0; i < values.Data.GetLength(0); i++) { 39 double target = values.Data[i, 1]; 40 40 if (!double.IsNaN(target) && !double.IsInfinity(target)) { 41 41 target = target - targetMean;
Note: See TracChangeset
for help on using the changeset viewer.