- Timestamp:
- 04/16/13 13:13:41 (12 years ago)
- Location:
- branches/OaaS
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/OaaS
- Property svn:ignore
-
old new 21 21 protoc.exe 22 22 _ReSharper.HeuristicLab 3.3 Tests 23 Google.ProtocolBuffers-2.4.1.473.dll 23 24 packages
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
branches/OaaS/HeuristicLab.Problems.DataAnalysis
- Property svn:mergeinfo changed
-
branches/OaaS/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/ConstantRegressionModel.cs
r7259 r9363 27 27 28 28 namespace HeuristicLab.Problems.DataAnalysis { 29 [StorableClass] 29 30 [Item("Constant Regression Model", "A model that always returns the same constant value regardless of the presented input data.")] 30 31 public class ConstantRegressionModel : NamedItem, IRegressionModel { 31 32 [Storable] 32 pr ivatedouble constant;33 protected double constant; 33 34 public double Constant { 34 35 get { return constant; } … … 55 56 56 57 public IRegressionSolution CreateRegressionSolution(IRegressionProblemData problemData) { 57 return new ConstantRegressionSolution(this, problemData);58 return new ConstantRegressionSolution(this, new RegressionProblemData(problemData)); 58 59 } 59 60 } -
branches/OaaS/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/ConstantRegressionSolution.cs
r7049 r9363 1 using HeuristicLab.Common; 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2012 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 HeuristicLab.Common; 2 23 using HeuristicLab.Core; 3 24 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; -
branches/OaaS/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionEnsembleModel.cs
r7259 r9363 102 102 103 103 public RegressionEnsembleSolution CreateRegressionSolution(IRegressionProblemData problemData) { 104 return new RegressionEnsembleSolution(this.Models, problemData);104 return new RegressionEnsembleSolution(this.Models, new RegressionEnsembleProblemData(problemData)); 105 105 } 106 106 IRegressionSolution IRegressionModel.CreateRegressionSolution(IRegressionProblemData problemData) { -
branches/OaaS/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionEnsembleSolution.cs
r8174 r9363 36 36 [Item("Regression Ensemble Solution", "A regression solution that contains an ensemble of multiple regression models")] 37 37 [Creatable("Data Analysis - Ensembles")] 38 public sealed class RegressionEnsembleSolution : RegressionSolution , IRegressionEnsembleSolution {38 public sealed class RegressionEnsembleSolution : RegressionSolutionBase, IRegressionEnsembleSolution { 39 39 private readonly Dictionary<int, double> trainingEvaluationCache = new Dictionary<int, double>(); 40 40 private readonly Dictionary<int, double> testEvaluationCache = new Dictionary<int, double>(); 41 private readonly Dictionary<int, double> evaluationCache = new Dictionary<int, double>(); 41 42 42 43 public new IRegressionEnsembleModel Model { … … 155 156 } 156 157 157 protected override void RecalculateResults() {158 CalculateResults();159 }160 161 158 #region Evaluation 159 public override IEnumerable<double> EstimatedValues { 160 get { return GetEstimatedValues(Enumerable.Range(0, ProblemData.Dataset.Rows)); } 161 } 162 162 163 public override IEnumerable<double> EstimatedTrainingValues { 163 164 get { -
branches/OaaS/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionProblem.cs
r7823 r9363 36 36 public override IDeepCloneable Clone(Cloner cloner) { return new RegressionProblem(this, cloner); } 37 37 38 public RegressionProblem() 39 : base() { 40 ProblemData = new RegressionProblemData(); 41 } 38 public RegressionProblem() : base(new RegressionProblemData()) { } 39 42 40 } 43 41 } -
branches/OaaS/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionProblemData.cs
r8121 r9363 121 121 : this(defaultDataset, defaultAllowedInputVariables, defaultTargetVariable) { 122 122 } 123 public RegressionProblemData(IRegressionProblemData regressionProblemData) 124 : this(regressionProblemData.Dataset, regressionProblemData.AllowedInputVariables, regressionProblemData.TargetVariable) { 125 TrainingPartition.Start = regressionProblemData.TrainingPartition.Start; 126 TrainingPartition.End = regressionProblemData.TrainingPartition.End; 127 TestPartition.Start = regressionProblemData.TestPartition.Start; 128 TestPartition.End = regressionProblemData.TestPartition.End; 129 } 123 130 124 131 public RegressionProblemData(Dataset dataset, IEnumerable<string> allowedInputVariables, string targetVariable) -
branches/OaaS/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionSolution.cs
r8139 r9363 45 45 : base(model, problemData) { 46 46 evaluationCache = new Dictionary<int, double>(problemData.Dataset.Rows); 47 CalculateRegressionResults(); 47 48 } 48 49 49 protected override void RecalculateResults() {50 CalculateResults();51 }52 50 53 51 public override IEnumerable<double> EstimatedValues { -
branches/OaaS/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionSolutionBase.cs
r8139 r9363 29 29 [StorableClass] 30 30 public abstract class RegressionSolutionBase : DataAnalysisSolution, IRegressionSolution { 31 private const string TrainingMeanSquaredErrorResultName = "Mean squared error (training)"; 32 private const string TestMeanSquaredErrorResultName = "Mean squared error (test)"; 33 private const string TrainingMeanAbsoluteErrorResultName = "Mean absolute error (training)"; 34 private const string TestMeanAbsoluteErrorResultName = "Mean absolute error (test)"; 35 private const string TrainingSquaredCorrelationResultName = "Pearson's R² (training)"; 36 private const string TestSquaredCorrelationResultName = "Pearson's R² (test)"; 37 private const string TrainingRelativeErrorResultName = "Average relative error (training)"; 38 private const string TestRelativeErrorResultName = "Average relative error (test)"; 39 private const string TrainingNormalizedMeanSquaredErrorResultName = "Normalized mean squared error (training)"; 40 private const string TestNormalizedMeanSquaredErrorResultName = "Normalized mean squared error (test)"; 41 private const string TrainingMeanErrorResultName = "Mean error (training)"; 42 private const string TestMeanErrorResultName = "Mean error (test)"; 31 protected const string TrainingMeanSquaredErrorResultName = "Mean squared error (training)"; 32 protected const string TestMeanSquaredErrorResultName = "Mean squared error (test)"; 33 protected const string TrainingMeanAbsoluteErrorResultName = "Mean absolute error (training)"; 34 protected const string TestMeanAbsoluteErrorResultName = "Mean absolute error (test)"; 35 protected const string TrainingSquaredCorrelationResultName = "Pearson's R² (training)"; 36 protected const string TestSquaredCorrelationResultName = "Pearson's R² (test)"; 37 protected const string TrainingRelativeErrorResultName = "Average relative error (training)"; 38 protected const string TestRelativeErrorResultName = "Average relative error (test)"; 39 protected const string TrainingNormalizedMeanSquaredErrorResultName = "Normalized mean squared error (training)"; 40 protected const string TestNormalizedMeanSquaredErrorResultName = "Normalized mean squared error (test)"; 41 protected const string TrainingMeanErrorResultName = "Mean error (training)"; 42 protected const string TestMeanErrorResultName = "Mean error (test)"; 43 44 protected const string TrainingMeanSquaredErrorResultDescription = "Mean of squared errors of the model on the training partition"; 45 protected const string TestMeanSquaredErrorResultDescription = "Mean of squared errors of the model on the test partition"; 46 protected const string TrainingMeanAbsoluteErrorResultDescription = "Mean of absolute errors of the model on the training partition"; 47 protected const string TestMeanAbsoluteErrorResultDescription = "Mean of absolute errors of the model on the test partition"; 48 protected const string TrainingSquaredCorrelationResultDescription = "Squared Pearson's correlation coefficient of the model output and the actual values on the training partition"; 49 protected const string TestSquaredCorrelationResultDescription = "Squared Pearson's correlation coefficient of the model output and the actual values on the test partition"; 50 protected const string TrainingRelativeErrorResultDescription = "Average of the relative errors of the model output and the actual values on the training partition"; 51 protected const string TestRelativeErrorResultDescription = "Average of the relative errors of the model output and the actual values on the test partition"; 52 protected const string TrainingNormalizedMeanSquaredErrorResultDescription = "Normalized mean of squared errors of the model on the training partition"; 53 protected const string TestNormalizedMeanSquaredErrorResultDescription = "Normalized mean of squared errors of the model on the test partition"; 54 protected const string TrainingMeanErrorResultDescription = "Mean of errors of the model on the training partition"; 55 protected const string TestMeanErrorResultDescription = "Mean of errors of the model on the test partition"; 43 56 44 57 public new IRegressionModel Model { … … 115 128 protected RegressionSolutionBase(IRegressionModel model, IRegressionProblemData problemData) 116 129 : base(model, problemData) { 117 Add(new Result(TrainingMeanSquaredErrorResultName, "Mean of squared errors of the model on the training partition", new DoubleValue()));118 Add(new Result(TestMeanSquaredErrorResultName, "Mean of squared errors of the model on the test partition", new DoubleValue()));119 Add(new Result(TrainingMeanAbsoluteErrorResultName, "Mean of absolute errors of the model on the training partition", new DoubleValue()));120 Add(new Result(TestMeanAbsoluteErrorResultName, "Mean of absolute errors of the model on the test partition", new DoubleValue()));121 Add(new Result(TrainingSquaredCorrelationResultName, "Squared Pearson's correlation coefficient of the model output and the actual values on the training partition", new DoubleValue()));122 Add(new Result(TestSquaredCorrelationResultName, "Squared Pearson's correlation coefficient of the model output and the actual values on the test partition", new DoubleValue()));123 Add(new Result(TrainingRelativeErrorResultName, "Average of the relative errors of the model output and the actual values on the training partition", new PercentValue()));124 Add(new Result(TestRelativeErrorResultName, "Average of the relative errors of the model output and the actual values on the test partition", new PercentValue()));125 Add(new Result(TrainingNormalizedMeanSquaredErrorResultName, "Normalized mean of squared errors of the model on the training partition", new DoubleValue()));126 Add(new Result(TestNormalizedMeanSquaredErrorResultName, "Normalized mean of squared errors of the model on the test partition", new DoubleValue()));127 Add(new Result(TrainingMeanErrorResultName, "Mean of errors of the model on the training partition", new DoubleValue()));128 Add(new Result(TestMeanErrorResultName, "Mean of errors of the model on the test partition", new DoubleValue()));130 Add(new Result(TrainingMeanSquaredErrorResultName, TrainingMeanSquaredErrorResultDescription, new DoubleValue())); 131 Add(new Result(TestMeanSquaredErrorResultName, TestMeanSquaredErrorResultDescription, new DoubleValue())); 132 Add(new Result(TrainingMeanAbsoluteErrorResultName, TrainingMeanAbsoluteErrorResultDescription, new DoubleValue())); 133 Add(new Result(TestMeanAbsoluteErrorResultName, TestMeanAbsoluteErrorResultDescription, new DoubleValue())); 134 Add(new Result(TrainingSquaredCorrelationResultName, TrainingSquaredCorrelationResultDescription, new DoubleValue())); 135 Add(new Result(TestSquaredCorrelationResultName, TestSquaredCorrelationResultDescription, new DoubleValue())); 136 Add(new Result(TrainingRelativeErrorResultName, TrainingRelativeErrorResultDescription, new PercentValue())); 137 Add(new Result(TestRelativeErrorResultName, TestRelativeErrorResultDescription, new PercentValue())); 138 Add(new Result(TrainingNormalizedMeanSquaredErrorResultName, TrainingNormalizedMeanSquaredErrorResultDescription, new DoubleValue())); 139 Add(new Result(TestNormalizedMeanSquaredErrorResultName, TestNormalizedMeanSquaredErrorResultDescription, new DoubleValue())); 140 Add(new Result(TrainingMeanErrorResultName, TrainingMeanErrorResultDescription, new DoubleValue())); 141 Add(new Result(TestMeanErrorResultName, TestMeanErrorResultDescription, new DoubleValue())); 129 142 } 130 143 … … 164 177 } 165 178 166 protected void CalculateResults() { 179 protected override void RecalculateResults() { 180 CalculateRegressionResults(); 181 } 182 183 protected void CalculateRegressionResults() { 167 184 IEnumerable<double> estimatedTrainingValues = EstimatedTrainingValues; // cache values 168 185 IEnumerable<double> originalTrainingValues = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TrainingIndices);
Note: See TracChangeset
for help on using the changeset viewer.