Changeset 7085 for branches/RegressionBenchmarks/HeuristicLab.Problems.DataAnalysis/3.4/Implementation
- Timestamp:
- 11/28/11 13:47:28 (13 years ago)
- Location:
- branches/RegressionBenchmarks
- Files:
-
- 12 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/RegressionBenchmarks
- Property svn:ignore
-
old new 4 4 *.suo 5 5 *.vsp 6 Doxygen 6 7 Google.ProtocolBuffers-0.9.1.dll 7 8 HeuristicLab 3.3.5.1.ReSharper.user 8 9 HeuristicLab 3.3.6.0.ReSharper.user 9 10 HeuristicLab.4.5.resharper.user 11 HeuristicLab.ExtLibs.6.0.ReSharper.user 10 12 HeuristicLab.resharper.user 11 13 ProtoGen.exe … … 16 18 bin 17 19 protoc.exe 18 HeuristicLab.ExtLibs.6.0.ReSharper.user19 Doxygen
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
branches/RegressionBenchmarks/HeuristicLab.Problems.DataAnalysis
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Problems.DataAnalysis (added) merged: 6961,6963-6964,6974,6980,6982,7011,7017,7021,7023,7043,7049
- Property svn:mergeinfo changed
-
branches/RegressionBenchmarks/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/ClassificationEnsembleProblemData.cs
r6672 r7085 43 43 44 44 private static readonly ClassificationEnsembleProblemData emptyProblemData; 45 public static ClassificationEnsembleProblemData EmptyProblemData {45 public static new ClassificationEnsembleProblemData EmptyProblemData { 46 46 get { return emptyProblemData; } 47 47 } -
branches/RegressionBenchmarks/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/ClassificationEnsembleSolution.cs
r6666 r7085 201 201 202 202 public IEnumerable<IEnumerable<double>> GetEstimatedClassValueVectors(Dataset dataset, IEnumerable<int> rows) { 203 if (!Model.Models.Any()) yield break; 203 204 var estimatedValuesEnumerators = (from model in Model.Models 204 205 select model.GetEstimatedClassValues(dataset, rows).GetEnumerator()) -
branches/RegressionBenchmarks/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/ClassificationProblem.cs
r7025 r7085 28 28 [Item("Classification Problem", "A general classification problem.")] 29 29 [Creatable("Problems")] 30 public class ClassificationProblem : DataAnalysisProblem<IClassificationProblemData>, IClassificationProblem { 30 public class ClassificationProblem : DataAnalysisProblem<IClassificationProblemData>, IClassificationProblem, IStorableContent { 31 public string Filename { get; set; } 32 31 33 [StorableConstructor] 32 34 protected ClassificationProblem(bool deserializing) : base(deserializing) { } -
branches/RegressionBenchmarks/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/ClassificationSolutionBase.cs
r6913 r7085 77 77 } 78 78 79 [StorableHook(HookType.AfterDeserialization)] 80 private void AfterDeserialization() { 81 if (!this.ContainsKey(TrainingNormalizedGiniCoefficientResultName)) 82 Add(new Result(TrainingNormalizedGiniCoefficientResultName, "Normalized Gini coefficient of the model on the training partition.", new DoubleValue())); 83 if (!this.ContainsKey(TestNormalizedGiniCoefficientResultName)) 84 Add(new Result(TestNormalizedGiniCoefficientResultName, "Normalized Gini coefficient of the model on the test partition.", new DoubleValue())); 85 } 86 79 87 protected void CalculateResults() { 80 88 double[] estimatedTrainingClassValues = EstimatedTrainingClassValues.ToArray(); // cache values … … 84 92 85 93 OnlineCalculatorError errorState; 86 double trainingAccuracy = OnlineAccuracyCalculator.Calculate( estimatedTrainingClassValues, originalTrainingClassValues, out errorState);94 double trainingAccuracy = OnlineAccuracyCalculator.Calculate(originalTrainingClassValues, estimatedTrainingClassValues, out errorState); 87 95 if (errorState != OnlineCalculatorError.None) trainingAccuracy = double.NaN; 88 double testAccuracy = OnlineAccuracyCalculator.Calculate( estimatedTestClassValues, originalTestClassValues, out errorState);96 double testAccuracy = OnlineAccuracyCalculator.Calculate(originalTestClassValues, estimatedTestClassValues, out errorState); 89 97 if (errorState != OnlineCalculatorError.None) testAccuracy = double.NaN; 90 98 -
branches/RegressionBenchmarks/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/DiscriminantFunctionClassificationSolutionBase.cs
r6913 r7085 108 108 109 109 OnlineCalculatorError errorState; 110 double trainingMSE = OnlineMeanSquaredErrorCalculator.Calculate( estimatedTrainingValues, originalTrainingValues, out errorState);110 double trainingMSE = OnlineMeanSquaredErrorCalculator.Calculate(originalTrainingValues, estimatedTrainingValues, out errorState); 111 111 TrainingMeanSquaredError = errorState == OnlineCalculatorError.None ? trainingMSE : double.NaN; 112 double testMSE = OnlineMeanSquaredErrorCalculator.Calculate( estimatedTestValues, originalTestValues, out errorState);112 double testMSE = OnlineMeanSquaredErrorCalculator.Calculate(originalTestValues, estimatedTestValues, out errorState); 113 113 TestMeanSquaredError = errorState == OnlineCalculatorError.None ? testMSE : double.NaN; 114 114 115 double trainingR2 = OnlinePearsonsRSquaredCalculator.Calculate( estimatedTrainingValues, originalTrainingValues, out errorState);115 double trainingR2 = OnlinePearsonsRSquaredCalculator.Calculate(originalTrainingValues, estimatedTrainingValues, out errorState); 116 116 TrainingRSquared = errorState == OnlineCalculatorError.None ? trainingR2 : double.NaN; 117 double testR2 = OnlinePearsonsRSquaredCalculator.Calculate( estimatedTestValues, originalTestValues, out errorState);117 double testR2 = OnlinePearsonsRSquaredCalculator.Calculate(originalTestValues, estimatedTestValues, out errorState); 118 118 TestRSquared = errorState == OnlineCalculatorError.None ? testR2 : double.NaN; 119 119 -
branches/RegressionBenchmarks/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionEnsembleSolution.cs
r6666 r7085 64 64 private void AfterDeserialization() { 65 65 foreach (var model in Model.Models) { 66 IRegressionProblemData problemData = (IRegressionProblemData) 66 IRegressionProblemData problemData = (IRegressionProblemData)ProblemData.Clone(); 67 67 problemData.TrainingPartition.Start = trainingPartitions[model].Start; 68 68 problemData.TrainingPartition.End = trainingPartitions[model].End; … … 202 202 203 203 public IEnumerable<IEnumerable<double>> GetEstimatedValueVectors(Dataset dataset, IEnumerable<int> rows) { 204 if (!Model.Models.Any()) yield break; 204 205 var estimatedValuesEnumerators = (from model in Model.Models 205 206 select model.GetEstimatedValues(dataset, rows).GetEnumerator()) -
branches/RegressionBenchmarks/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionProblem.cs
r7025 r7085 28 28 [Item("Regression Problem", "A general regression problem.")] 29 29 [Creatable("Problems")] 30 public class RegressionProblem : DataAnalysisProblem<IRegressionProblemData>, IRegressionProblem { 30 public class RegressionProblem : DataAnalysisProblem<IRegressionProblemData>, IRegressionProblem, IStorableContent { 31 public string Filename { get; set; } 32 31 33 [StorableConstructor] 32 34 protected RegressionProblem(bool deserializing) : base(deserializing) { } -
branches/RegressionBenchmarks/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionSolutionBase.cs
r6740 r7085 147 147 148 148 OnlineCalculatorError errorState; 149 double trainingMSE = OnlineMeanSquaredErrorCalculator.Calculate( estimatedTrainingValues, originalTrainingValues, out errorState);149 double trainingMSE = OnlineMeanSquaredErrorCalculator.Calculate(originalTrainingValues, estimatedTrainingValues, out errorState); 150 150 TrainingMeanSquaredError = errorState == OnlineCalculatorError.None ? trainingMSE : double.NaN; 151 double testMSE = OnlineMeanSquaredErrorCalculator.Calculate( estimatedTestValues, originalTestValues, out errorState);151 double testMSE = OnlineMeanSquaredErrorCalculator.Calculate(originalTestValues, estimatedTestValues, out errorState); 152 152 TestMeanSquaredError = errorState == OnlineCalculatorError.None ? testMSE : double.NaN; 153 153 154 double trainingMAE = OnlineMeanAbsoluteErrorCalculator.Calculate( estimatedTrainingValues, originalTrainingValues, out errorState);154 double trainingMAE = OnlineMeanAbsoluteErrorCalculator.Calculate(originalTrainingValues, estimatedTrainingValues, out errorState); 155 155 TrainingMeanAbsoluteError = errorState == OnlineCalculatorError.None ? trainingMAE : double.NaN; 156 double testMAE = OnlineMeanAbsoluteErrorCalculator.Calculate( estimatedTestValues, originalTestValues, out errorState);156 double testMAE = OnlineMeanAbsoluteErrorCalculator.Calculate(originalTestValues, estimatedTestValues, out errorState); 157 157 TestMeanAbsoluteError = errorState == OnlineCalculatorError.None ? testMAE : double.NaN; 158 158 159 double trainingR2 = OnlinePearsonsRSquaredCalculator.Calculate( estimatedTrainingValues, originalTrainingValues, out errorState);159 double trainingR2 = OnlinePearsonsRSquaredCalculator.Calculate(originalTrainingValues, estimatedTrainingValues, out errorState); 160 160 TrainingRSquared = errorState == OnlineCalculatorError.None ? trainingR2 : double.NaN; 161 double testR2 = OnlinePearsonsRSquaredCalculator.Calculate( estimatedTestValues, originalTestValues, out errorState);161 double testR2 = OnlinePearsonsRSquaredCalculator.Calculate(originalTestValues, estimatedTestValues, out errorState); 162 162 TestRSquared = errorState == OnlineCalculatorError.None ? testR2 : double.NaN; 163 163 164 double trainingRelError = OnlineMeanAbsolutePercentageErrorCalculator.Calculate( estimatedTrainingValues, originalTrainingValues, out errorState);164 double trainingRelError = OnlineMeanAbsolutePercentageErrorCalculator.Calculate(originalTrainingValues, estimatedTrainingValues, out errorState); 165 165 TrainingRelativeError = errorState == OnlineCalculatorError.None ? trainingRelError : double.NaN; 166 double testRelError = OnlineMeanAbsolutePercentageErrorCalculator.Calculate( estimatedTestValues, originalTestValues, out errorState);166 double testRelError = OnlineMeanAbsolutePercentageErrorCalculator.Calculate(originalTestValues, estimatedTestValues, out errorState); 167 167 TestRelativeError = errorState == OnlineCalculatorError.None ? testRelError : double.NaN; 168 168 169 double trainingNMSE = OnlineNormalizedMeanSquaredErrorCalculator.Calculate( estimatedTrainingValues, originalTrainingValues, out errorState);169 double trainingNMSE = OnlineNormalizedMeanSquaredErrorCalculator.Calculate(originalTrainingValues, estimatedTrainingValues, out errorState); 170 170 TrainingNormalizedMeanSquaredError = errorState == OnlineCalculatorError.None ? trainingNMSE : double.NaN; 171 double testNMSE = OnlineNormalizedMeanSquaredErrorCalculator.Calculate( estimatedTestValues, originalTestValues, out errorState);171 double testNMSE = OnlineNormalizedMeanSquaredErrorCalculator.Calculate(originalTestValues, estimatedTestValues, out errorState); 172 172 TestNormalizedMeanSquaredError = errorState == OnlineCalculatorError.None ? testNMSE : double.NaN; 173 173 } -
branches/RegressionBenchmarks/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/TimeSeriesPrognosis/TimeSeriesPrognosisProblemData.cs
r6802 r7085 1565 1565 problemData.Parameters.Add(new FixedValueParameter<IntRange>(TestPartitionParameterName, "", (IntRange)new IntRange(0, 0).AsReadOnly())); 1566 1566 problemData.Parameters.Add(new ConstrainedValueParameter<StringValue>(TargetVariableParameterName, new ItemSet<StringValue>())); 1567 emptyProblemData = problemData; 1567 emptyProblemData = problemData; 1568 1568 } 1569 1569 #endregion -
branches/RegressionBenchmarks/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/TimeSeriesPrognosis/TimeSeriesPrognosisSolutionBase.cs
r6802 r7085 40 40 private const string TrainingNormalizedMeanSquaredErrorResultName = "Normalized mean squared error (training)"; 41 41 private const string TestNormalizedMeanSquaredErrorResultName = "Normalized mean squared error (test)"; 42 private const string TrainingDirectionalSymmetryResultName = " Directional symmetry (training)";43 private const string TestDirectionalSymmetryResultName = " Directional symmetry (test)";44 private const string TrainingWeightedDirectionalSymmetryResultName = " Weighted directional symmetry (training)";45 private const string TestWeightedDirectionalSymmetryResultName = " Weighted directional symmetry (test)";46 private const string TrainingTheilsUStatisticResultName = " Theil's U (training)";47 private const string TestTheilsUStatisticResultName = " Theil's U (test)";42 private const string TrainingDirectionalSymmetryResultName = "Average directional symmetry (training)"; 43 private const string TestDirectionalSymmetryResultName = "Average directional symmetry (test)"; 44 private const string TrainingWeightedDirectionalSymmetryResultName = "Average weighted directional symmetry (training)"; 45 private const string TestWeightedDirectionalSymmetryResultName = "Average weighted directional symmetry (test)"; 46 private const string TrainingTheilsUStatisticResultName = "Average Theil's U (training)"; 47 private const string TestTheilsUStatisticResultName = "Average Theil's U (test)"; 48 48 49 49 public new ITimeSeriesPrognosisModel Model { … … 146 146 Add(new Result(TrainingNormalizedMeanSquaredErrorResultName, "Normalized mean of squared errors of the model on the training partition", new DoubleValue())); 147 147 Add(new Result(TestNormalizedMeanSquaredErrorResultName, "Normalized mean of squared errors of the model on the test partition", new DoubleValue())); 148 Add(new Result(TrainingDirectionalSymmetryResultName, "The directional symmetry of the output of the model on the training partition", new DoubleValue()));149 Add(new Result(TestDirectionalSymmetryResultName, "The directional symmetry of the output of the model on the test partition", new DoubleValue()));150 Add(new Result(TrainingWeightedDirectionalSymmetryResultName, "The weighted directional symmetry of the outputof the model on the training partition", new DoubleValue()));151 Add(new Result(TestWeightedDirectionalSymmetryResultName, "The weighted directional symmetry of the outputof the model on the test partition", new DoubleValue()));152 Add(new Result(TrainingTheilsUStatisticResultName, "The Theil's U statistic of the outputof the model on the training partition", new DoubleValue()));153 Add(new Result(TestTheilsUStatisticResultName, "The Theil's U statistic of the outputof the model on the test partition", new DoubleValue()));148 Add(new Result(TrainingDirectionalSymmetryResultName, "The average directional symmetry of the forecasts of the model on the training partition", new PercentValue())); 149 Add(new Result(TestDirectionalSymmetryResultName, "The average directional symmetry of the forecasts of the model on the test partition", new PercentValue())); 150 Add(new Result(TrainingWeightedDirectionalSymmetryResultName, "The average weighted directional symmetry of the forecasts of the model on the training partition", new DoubleValue())); 151 Add(new Result(TestWeightedDirectionalSymmetryResultName, "The average weighted directional symmetry of the forecasts of the model on the test partition", new DoubleValue())); 152 Add(new Result(TrainingTheilsUStatisticResultName, "The average Theil's U statistic of the forecasts of the model on the training partition", new DoubleValue())); 153 Add(new Result(TestTheilsUStatisticResultName, "The average Theil's U statistic of the forecasts of the model on the test partition", new DoubleValue())); 154 154 } 155 155 … … 166 166 167 167 OnlineCalculatorError errorState; 168 double trainingMse = OnlineMeanSquaredErrorCalculator.Calculate( estimatedTrainingValues, originalTrainingValues, out errorState);168 double trainingMse = OnlineMeanSquaredErrorCalculator.Calculate(originalTrainingValues, estimatedTrainingValues, out errorState); 169 169 TrainingMeanSquaredError = errorState == OnlineCalculatorError.None ? trainingMse : double.NaN; 170 double testMse = OnlineMeanSquaredErrorCalculator.Calculate( estimatedTestValues, originalTestValues, out errorState);170 double testMse = OnlineMeanSquaredErrorCalculator.Calculate(originalTestValues, estimatedTestValues, out errorState); 171 171 TestMeanSquaredError = errorState == OnlineCalculatorError.None ? testMse : double.NaN; 172 172 173 double trainingMae = OnlineMeanAbsoluteErrorCalculator.Calculate( estimatedTrainingValues, originalTrainingValues, out errorState);173 double trainingMae = OnlineMeanAbsoluteErrorCalculator.Calculate(originalTrainingValues, estimatedTrainingValues, out errorState); 174 174 TrainingMeanAbsoluteError = errorState == OnlineCalculatorError.None ? trainingMae : double.NaN; 175 double testMae = OnlineMeanAbsoluteErrorCalculator.Calculate( estimatedTestValues, originalTestValues, out errorState);175 double testMae = OnlineMeanAbsoluteErrorCalculator.Calculate(originalTestValues, estimatedTestValues, out errorState); 176 176 TestMeanAbsoluteError = errorState == OnlineCalculatorError.None ? testMae : double.NaN; 177 177 178 double trainingR2 = OnlinePearsonsRSquaredCalculator.Calculate( estimatedTrainingValues, originalTrainingValues, out errorState);178 double trainingR2 = OnlinePearsonsRSquaredCalculator.Calculate(originalTrainingValues, estimatedTrainingValues, out errorState); 179 179 TrainingRSquared = errorState == OnlineCalculatorError.None ? trainingR2 : double.NaN; 180 double testR2 = OnlinePearsonsRSquaredCalculator.Calculate( estimatedTestValues, originalTestValues, out errorState);180 double testR2 = OnlinePearsonsRSquaredCalculator.Calculate(originalTestValues, estimatedTestValues, out errorState); 181 181 TestRSquared = errorState == OnlineCalculatorError.None ? testR2 : double.NaN; 182 182 183 double trainingRelError = OnlineMeanAbsolutePercentageErrorCalculator.Calculate( estimatedTrainingValues, originalTrainingValues, out errorState);183 double trainingRelError = OnlineMeanAbsolutePercentageErrorCalculator.Calculate(originalTrainingValues, estimatedTrainingValues, out errorState); 184 184 TrainingRelativeError = errorState == OnlineCalculatorError.None ? trainingRelError : double.NaN; 185 double testRelError = OnlineMeanAbsolutePercentageErrorCalculator.Calculate( estimatedTestValues, originalTestValues, out errorState);185 double testRelError = OnlineMeanAbsolutePercentageErrorCalculator.Calculate(originalTestValues, estimatedTestValues, out errorState); 186 186 TestRelativeError = errorState == OnlineCalculatorError.None ? testRelError : double.NaN; 187 187 188 double trainingNmse = OnlineNormalizedMeanSquaredErrorCalculator.Calculate( estimatedTrainingValues, originalTrainingValues, out errorState);188 double trainingNmse = OnlineNormalizedMeanSquaredErrorCalculator.Calculate(originalTrainingValues, estimatedTrainingValues, out errorState); 189 189 TrainingNormalizedMeanSquaredError = errorState == OnlineCalculatorError.None ? trainingNmse : double.NaN; 190 double testNmse = OnlineNormalizedMeanSquaredErrorCalculator.Calculate( estimatedTestValues, originalTestValues, out errorState);190 double testNmse = OnlineNormalizedMeanSquaredErrorCalculator.Calculate(originalTestValues, estimatedTestValues, out errorState); 191 191 TestNormalizedMeanSquaredError = errorState == OnlineCalculatorError.None ? testNmse : double.NaN; 192 192 193 double trainingDirectionalSymmetry = OnlineDirectionalSymmetryCalculator.Calculate(estimatedTrainingValues, originalTrainingValues, out errorState); 193 var startTrainingValues = originalTrainingValues; 194 // each continuation is only one element long 195 var actualContinuationsTraining = from x in originalTrainingValues.Skip(1) 196 select Enumerable.Repeat(x, 1); 197 // each forecast is only one elemnt long 198 // disregards the first estimated value (we could include this again by extending the list of original values by one step to the left 199 // this is the easier way 200 var predictedContinuationsTraining = from x in estimatedTrainingValues.Skip(1) 201 select Enumerable.Repeat(x, 1); 202 203 var startTestValues = originalTestValues; 204 var actualContinuationsTest = from x in originalTestValues.Skip(1) 205 select Enumerable.Repeat(x, 1); 206 var predictedContinuationsTest = from x in estimatedTestValues.Skip(1) 207 select Enumerable.Repeat(x, 1); 208 209 double trainingDirectionalSymmetry = OnlineDirectionalSymmetryCalculator.Calculate(startTrainingValues, actualContinuationsTraining, predictedContinuationsTraining, out errorState); 194 210 TrainingDirectionalSymmetry = errorState == OnlineCalculatorError.None ? trainingDirectionalSymmetry : double.NaN; 195 double testDirectionalSymmetry = OnlineDirectionalSymmetryCalculator.Calculate( estimatedTestValues, originalTestValues, out errorState);211 double testDirectionalSymmetry = OnlineDirectionalSymmetryCalculator.Calculate(startTestValues, actualContinuationsTest, predictedContinuationsTest, out errorState); 196 212 TestDirectionalSymmetry = errorState == OnlineCalculatorError.None ? testDirectionalSymmetry : double.NaN; 197 213 198 double trainingWeightedDirectionalSymmetry = OnlineWeightedDirectionalSymmetryCalculator.Calculate( estimatedTrainingValues, originalTrainingValues, out errorState);214 double trainingWeightedDirectionalSymmetry = OnlineWeightedDirectionalSymmetryCalculator.Calculate(startTrainingValues, actualContinuationsTraining, predictedContinuationsTraining, out errorState); 199 215 TrainingWeightedDirectionalSymmetry = errorState == OnlineCalculatorError.None ? trainingWeightedDirectionalSymmetry : double.NaN; 200 double testWeightedDirectionalSymmetry = OnlineWeightedDirectionalSymmetryCalculator.Calculate( estimatedTestValues, originalTestValues, out errorState);216 double testWeightedDirectionalSymmetry = OnlineWeightedDirectionalSymmetryCalculator.Calculate(startTestValues, actualContinuationsTest, predictedContinuationsTest, out errorState); 201 217 TestWeightedDirectionalSymmetry = errorState == OnlineCalculatorError.None ? testWeightedDirectionalSymmetry : double.NaN; 202 218 203 double trainingTheilsU = OnlineTheilsUStatisticCalculator.Calculate( estimatedTrainingValues, originalTrainingValues, out errorState);219 double trainingTheilsU = OnlineTheilsUStatisticCalculator.Calculate(startTrainingValues, actualContinuationsTraining, predictedContinuationsTraining, out errorState); 204 220 TrainingTheilsUStatistic = errorState == OnlineCalculatorError.None ? trainingTheilsU : double.NaN; 205 double testTheilsU = OnlineTheilsUStatisticCalculator.Calculate( estimatedTestValues, originalTestValues, out errorState);221 double testTheilsU = OnlineTheilsUStatisticCalculator.Calculate(startTestValues, actualContinuationsTest, predictedContinuationsTest, out errorState); 206 222 TestTheilsUStatistic = errorState == OnlineCalculatorError.None ? testTheilsU : double.NaN; 207 208 209 223 } 210 224 }
Note: See TracChangeset
for help on using the changeset viewer.