Last change
on this file since 2188 was
1888,
checked in by gkronber, 15 years ago
|
Added simple evaluators for mean absolute percentage error, mean absolute percentage of range error and, variance accounted for. #635 (Plugin HeuristicLab.Modeling as a common basis for all data-based modeling algorithms)
|
File size:
1.2 KB
|
Line | |
---|
1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Linq;
|
---|
4 | using System.Text;
|
---|
5 | using HeuristicLab.Core;
|
---|
6 | using HeuristicLab.Data;
|
---|
7 | using HeuristicLab.DataAnalysis;
|
---|
8 |
|
---|
9 | namespace HeuristicLab.Modeling {
|
---|
10 | public abstract class SimpleEvaluatorBase : OperatorBase {
|
---|
11 | public virtual string OutputVariableName {
|
---|
12 | get { return "Quality"; }
|
---|
13 | }
|
---|
14 | public SimpleEvaluatorBase()
|
---|
15 | : base() {
|
---|
16 | AddVariableInfo(new VariableInfo("Values", "Target vs predicted values", typeof(DoubleMatrixData), VariableKind.In));
|
---|
17 | AddVariableInfo(new VariableInfo(OutputVariableName, OutputVariableName, typeof(DoubleData), VariableKind.New | VariableKind.Out));
|
---|
18 | }
|
---|
19 |
|
---|
20 | public override IOperation Apply(IScope scope) {
|
---|
21 | DoubleMatrixData values = GetVariableValue<DoubleMatrixData>("Values", scope, true);
|
---|
22 | DoubleData quality = GetVariableValue<DoubleData>(OutputVariableName, scope, false, false);
|
---|
23 | if (quality == null) {
|
---|
24 | quality = new DoubleData();
|
---|
25 | scope.AddVariable(new HeuristicLab.Core.Variable(scope.TranslateName(OutputVariableName), quality));
|
---|
26 | }
|
---|
27 |
|
---|
28 | quality.Data = Evaluate(values.Data);
|
---|
29 | return null;
|
---|
30 | }
|
---|
31 |
|
---|
32 | public abstract double Evaluate(double[,] values);
|
---|
33 | }
|
---|
34 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.