[2285] | 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 | using System;
|
---|
| 23 | using System.Collections.Generic;
|
---|
| 24 | using System.Text;
|
---|
| 25 | using HeuristicLab.Core;
|
---|
| 26 | using HeuristicLab.DataAnalysis;
|
---|
| 27 |
|
---|
| 28 | namespace HeuristicLab.Modeling {
|
---|
| 29 | public class AnalyzerModel : IAnalyzerModel {
|
---|
| 30 | public AnalyzerModel() { } // for persistence
|
---|
| 31 |
|
---|
| 32 | #region IModel Members
|
---|
| 33 |
|
---|
| 34 | private Dataset dataset;
|
---|
| 35 | public Dataset Dataset {
|
---|
| 36 | get { return dataset; }
|
---|
| 37 | set { dataset = value; }
|
---|
| 38 | }
|
---|
| 39 |
|
---|
| 40 | private string targetVariable;
|
---|
| 41 | public string TargetVariable {
|
---|
| 42 | get { return targetVariable; }
|
---|
| 43 | set { targetVariable = value; }
|
---|
| 44 | }
|
---|
| 45 |
|
---|
| 46 | private List<string> inputVariables = new List<string>();
|
---|
| 47 | public IEnumerable<string> InputVariables {
|
---|
| 48 | get { return inputVariables; }
|
---|
| 49 | }
|
---|
| 50 |
|
---|
| 51 | public int TrainingSamplesStart { get; set; }
|
---|
| 52 | public int TrainingSamplesEnd { get; set; }
|
---|
| 53 | public int ValidationSamplesStart { get; set; }
|
---|
| 54 | public int ValidationSamplesEnd { get; set; }
|
---|
| 55 | public int TestSamplesStart { get; set; }
|
---|
| 56 | public int TestSamplesEnd { get; set; }
|
---|
| 57 |
|
---|
| 58 | public void AddInputVariable(string variableName) {
|
---|
| 59 | if (!inputVariables.Contains(variableName))
|
---|
| 60 | inputVariables.Add(variableName);
|
---|
| 61 | }
|
---|
| 62 |
|
---|
[2344] | 63 | private Dictionary<string, double> results = new Dictionary<string, double>();
|
---|
| 64 | public IEnumerable<KeyValuePair<string, double>> Results {
|
---|
| 65 | get { return results; }
|
---|
[2285] | 66 | }
|
---|
| 67 |
|
---|
[2344] | 68 | public void SetResult(string name, double value) {
|
---|
| 69 | results.Add(name, value);
|
---|
[2285] | 70 | }
|
---|
| 71 |
|
---|
[2344] | 72 | public double GetResult(string name) {
|
---|
| 73 | return results[name];
|
---|
[2285] | 74 | }
|
---|
| 75 |
|
---|
[2344] | 76 | private Dictionary<string, object> metadata = new Dictionary<string, object>();
|
---|
| 77 | public IEnumerable<KeyValuePair<string, object>> MetaData {
|
---|
| 78 | get { return metadata; }
|
---|
[2285] | 79 | }
|
---|
| 80 |
|
---|
[2344] | 81 | public void SetMetaData(string name, object value) {
|
---|
| 82 | metadata.Add(name, value);
|
---|
[2285] | 83 | }
|
---|
| 84 |
|
---|
[2344] | 85 | public object GetMetaData(string name) {
|
---|
| 86 | return metadata[name];
|
---|
[2285] | 87 | }
|
---|
| 88 |
|
---|
| 89 | public double GetVariableQualityImpact(string variableName) {
|
---|
| 90 | if (variableQualityImpacts.ContainsKey(variableName)) return variableQualityImpacts[variableName];
|
---|
| 91 | else throw new ArgumentException("Impact of variable " + variableName + " is not available.");
|
---|
| 92 | }
|
---|
| 93 |
|
---|
| 94 | public double GetVariableEvaluationImpact(string variableName) {
|
---|
| 95 | if (variableEvaluationImpacts.ContainsKey(variableName)) return variableEvaluationImpacts[variableName];
|
---|
| 96 | else throw new ArgumentException("Impact of variable " + variableName + " is not available.");
|
---|
| 97 | }
|
---|
| 98 |
|
---|
| 99 | public IPredictor Predictor { get; set; }
|
---|
| 100 |
|
---|
| 101 | #endregion
|
---|
| 102 |
|
---|
| 103 | private Dictionary<string, double> variableQualityImpacts = new Dictionary<string, double>();
|
---|
| 104 | public void SetVariableQualityImpact(string variableName, double impact) {
|
---|
| 105 | variableQualityImpacts[variableName] = impact;
|
---|
| 106 | }
|
---|
| 107 |
|
---|
| 108 | public void SetVariableQualityImpact(int variableIndex, double impact) {
|
---|
| 109 | variableQualityImpacts[dataset.GetVariableName(variableIndex)] = impact;
|
---|
| 110 | }
|
---|
| 111 |
|
---|
| 112 | private Dictionary<string, double> variableEvaluationImpacts = new Dictionary<string, double>();
|
---|
| 113 | public void SetVariableEvaluationImpact(string variableName, double impact) {
|
---|
| 114 | variableEvaluationImpacts[variableName] = impact;
|
---|
| 115 | }
|
---|
| 116 |
|
---|
| 117 | public void SetVariableEvaluationImpact(int variableIndex, double impact) {
|
---|
| 118 | variableEvaluationImpacts[dataset.GetVariableName(variableIndex)] = impact;
|
---|
| 119 | }
|
---|
| 120 | }
|
---|
| 121 | }
|
---|