1 | #region License Information
|
---|
2 | /* HeuristicLab
|
---|
3 | * Copyright (C) 2002-2008 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 | #region License Information
|
---|
23 | /* HeuristicLab
|
---|
24 | * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
|
---|
25 | *
|
---|
26 | * This file is part of HeuristicLab.
|
---|
27 | *
|
---|
28 | * HeuristicLab is free software: you can redistribute it and/or modify
|
---|
29 | * it under the terms of the GNU General Public License as published by
|
---|
30 | * the Free Software Foundation, either version 3 of the License, or
|
---|
31 | * (at your option) any later version.
|
---|
32 | *
|
---|
33 | * HeuristicLab is distributed in the hope that it will be useful,
|
---|
34 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
35 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
36 | * GNU General Public License for more details.
|
---|
37 | *
|
---|
38 | * You should have received a copy of the GNU General Public License
|
---|
39 | * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
|
---|
40 | */
|
---|
41 | #endregion
|
---|
42 |
|
---|
43 | using System;
|
---|
44 | using System.Collections.Generic;
|
---|
45 | using System.Linq;
|
---|
46 | using System.Text;
|
---|
47 | using HeuristicLab.Core;
|
---|
48 | using System.Collections;
|
---|
49 | using HeuristicLab.CEDMA.DB.Interfaces;
|
---|
50 | using System.Xml;
|
---|
51 | using System.Runtime.Serialization;
|
---|
52 | using System.IO;
|
---|
53 | using HeuristicLab.PluginInfrastructure;
|
---|
54 |
|
---|
55 | namespace HeuristicLab.CEDMA.Charting {
|
---|
56 | public class Record {
|
---|
57 | public const string MAPE_TRAINING = "MAPE (training)";
|
---|
58 | public const string MAPE_VALIDATION = "MAPE (validation)";
|
---|
59 | public const string MAPE_TEST = "MAPE (test)";
|
---|
60 | public const string R2_TRAINING = "R2 (training)";
|
---|
61 | public const string R2_VALIDATION = "R2 (validation)";
|
---|
62 | public const string R2_TEST = "R2 (test)";
|
---|
63 | public const string TARGET_VARIABLE = "Target variable";
|
---|
64 | public const string TREE_SIZE = "Tree size";
|
---|
65 | public const string TREE_HEIGHT = "Tree height";
|
---|
66 |
|
---|
67 | public const string X_JITTER = "__X_JITTER";
|
---|
68 | public const string Y_JITTER = "__Y_JITTER";
|
---|
69 |
|
---|
70 | public event EventHandler OnSelectionChanged;
|
---|
71 |
|
---|
72 | private Dictionary<string, double> values = new Dictionary<string, double>();
|
---|
73 | private ResultList resultList;
|
---|
74 |
|
---|
75 | private bool selected = false;
|
---|
76 | public bool Selected { get { return selected; } }
|
---|
77 |
|
---|
78 | private string uri;
|
---|
79 | public string Uri { get { return uri; } }
|
---|
80 | public Record(ResultList resultList, string uri) {
|
---|
81 | this.uri = uri;
|
---|
82 | this.resultList = resultList;
|
---|
83 | }
|
---|
84 |
|
---|
85 | public void Set(string name, double value) {
|
---|
86 | values.Add(name, value);
|
---|
87 | }
|
---|
88 |
|
---|
89 | public double Get(string name) {
|
---|
90 | if(name == null || !values.ContainsKey(name)) return double.NaN;
|
---|
91 | return values[name];
|
---|
92 | }
|
---|
93 |
|
---|
94 | public void ToggleSelected() {
|
---|
95 | selected = !selected;
|
---|
96 | if(OnSelectionChanged != null) OnSelectionChanged(this, new EventArgs());
|
---|
97 | }
|
---|
98 |
|
---|
99 | internal string GetToolTipText() {
|
---|
100 | StringBuilder b = new StringBuilder();
|
---|
101 | foreach(KeyValuePair<string, double> v in values) {
|
---|
102 | if(v.Key != X_JITTER && v.Key != Y_JITTER) {
|
---|
103 | b.Append(v.Key).Append(" = ").Append(v.Value).AppendLine();
|
---|
104 | }
|
---|
105 | }
|
---|
106 | return b.ToString();
|
---|
107 | }
|
---|
108 |
|
---|
109 | internal void OpenModel() {
|
---|
110 | resultList.OpenModel(this);
|
---|
111 | }
|
---|
112 | }
|
---|
113 | } |
---|