Changeset 7183
- Timestamp:
- 12/13/11 13:52:22 (13 years ago)
- Location:
- branches/HeuristicLab.TimeSeries
- Files:
-
- 1 deleted
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis.Views/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis.Views-3.4.csproj
r7154 r7183 50 50 <DebugType>pdbonly</DebugType> 51 51 <Optimize>true</Optimize> 52 <OutputPath> bin\Release\</OutputPath>52 <OutputPath>..\..\bin\</OutputPath> 53 53 <DefineConstants>TRACE</DefineConstants> 54 54 <ErrorReport>prompt</ErrorReport> … … 110 110 </ItemGroup> 111 111 <ItemGroup> 112 <Compile Include="InteractiveSymbolicTimeSeriesPrognosisSolutionSimplifierView.cs"> 113 <SubType>UserControl</SubType> 114 </Compile> 115 <Compile Include="InteractiveSymbolicTimeSeriesPrognosisSolutionSimplifierView.Designer.cs"> 116 <DependentUpon>InteractiveSymbolicTimeSeriesPrognosisSolutionSimplifierView.cs</DependentUpon> 117 </Compile> 112 118 <Compile Include="Plugin.cs" /> 113 119 <Compile Include="SymbolicTimeSeriesPrognosisSolutionView.cs"> -
branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis.Views/3.4/InteractiveSymbolicTimeSeriesPrognosisSolutionSimplifierView.cs
r7154 r7183 57 57 protected override Dictionary<ISymbolicExpressionTreeNode, double> CalculateReplacementValues(ISymbolicExpressionTree tree) { 58 58 Dictionary<ISymbolicExpressionTreeNode, double> replacementValues = new Dictionary<ISymbolicExpressionTreeNode, double>(); 59 foreach (ISymbolicExpressionTreeNode node in tree.Root.GetSubtree(0).GetSubtree(0).IterateNodesPrefix()) { 60 replacementValues[node] = CalculateReplacementValue(node, tree); 61 } 59 foreach (var componentBranch in tree.Root.GetSubtree(0).Subtrees) 60 foreach (ISymbolicExpressionTreeNode node in componentBranch.IterateNodesPrefix()) { 61 replacementValues[node] = CalculateReplacementValue(node, tree); 62 } 62 63 return replacementValues; 63 64 } … … 72 73 .ToArray(); 73 74 int i = 0; 75 int nTargetVariables = Content.ProblemData.TargetVariables.Count(); 74 76 foreach (var targetVariable in Content.ProblemData.TargetVariables) { 75 77 List<ISymbolicExpressionTreeNode> nodes = tree.Root.GetSubtree(0).GetSubtree(i).IterateNodesPostfix().ToList(); 76 78 var targetValues = dataset.GetDoubleValues(targetVariable, rows); 77 79 OnlineCalculatorError errorState; 78 double originalR2 = OnlinePearsonsRSquaredCalculator.Calculate(targetValues, originalOutput.S elect(v => v.ElementAt(i)), out errorState);80 double originalR2 = OnlinePearsonsRSquaredCalculator.Calculate(targetValues, originalOutput.Skip(i).TakeEvery(nTargetVariables), out errorState); 79 81 if (errorState != OnlineCalculatorError.None) originalR2 = 0.0; 80 82 … … 85 87 SwitchNode(parent, node, replacementNode); 86 88 var newOutput = interpreter.GetSymbolicExpressionTreeValues(tree, dataset, Content.ProblemData.TargetVariables.ToArray(), rows, 1); 87 double newR2 = OnlinePearsonsRSquaredCalculator.Calculate(targetValues, newOutput.S elect(v => v.First().ElementAt(i)), out errorState);89 double newR2 = OnlinePearsonsRSquaredCalculator.Calculate(targetValues, newOutput.Skip(i).TakeEvery(nTargetVariables), out errorState); 88 90 if (errorState != OnlineCalculatorError.None) newR2 = 0.0; 89 91 … … 112 114 var rows = Content.ProblemData.TrainingIndizes; 113 115 var allPrognosedValues = interpreter.GetSymbolicExpressionTreeValues(tempTree, Content.ProblemData.Dataset, Content.ProblemData.TargetVariables.ToArray(), rows, 1); 114 115 return allPrognosedValues. Select(x=>x.First().First()).Median();116 117 return allPrognosedValues.Median(); 116 118 } 117 119 -
branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis.Views/3.4/SymbolicTimeSeriesPrognosisSolutionView.cs
r7154 r7183 39 39 40 40 private void btn_SimplifyModel_Click(object sender, EventArgs e) { 41 //InteractiveSymbolicTimeSeriesPrognosisSolutionSimplifierView view = new InteractiveSymbolicTimeSeriesPrognosisSolutionSimplifierView();42 //view.Content = (SymbolicTimeSeriesPrognosisSolution)this.Content.Clone();43 //view.Show();41 InteractiveSymbolicTimeSeriesPrognosisSolutionSimplifierView view = new InteractiveSymbolicTimeSeriesPrognosisSolutionSimplifierView(); 42 view.Content = (SymbolicTimeSeriesPrognosisSolution)this.Content.Clone(); 43 view.Show(); 44 44 } 45 45 } -
branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis-3.4.csproj
r7129 r7183 120 120 <SubType>Code</SubType> 121 121 </Compile> 122 <Compile Include="SingleObjective\SymbolicTimeSeriesPrognosisSingleObjectiveOverfittingAnalyzer.cs" /> 122 123 <Compile Include="SingleObjective\SymbolicTimeSeriesPrognosisSingleObjectiveProblem.cs" /> 123 124 <Compile Include="SingleObjective\SymbolicTimeSeriesPrognosisSingleObjectiveTrainingBestSolutionAnalyzer.cs" /> 125 <Compile Include="SingleObjective\SymbolicTimeSeriesPrognosisSingleObjectiveValidationBestSolutionAnalyzer.cs" /> 124 126 <Compile Include="SymbolicTimeSeriesPrognosisModel.cs" /> 125 127 <Compile Include="SymbolicTimeSeriesPrognosisSolution.cs" /> -
branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis/3.4/SingleObjective/SymbolicTimeSeriesPrognosisSingleObjectiveMeanSquaredErrorEvaluator.cs
r7154 r7183 93 93 meanCalculator.Add(calc.MeanSquaredError); 94 94 } 95 //int i = 0; 96 //foreach (var targetVariable in problemData.TargetVariables) { 97 // var predictedContinuations = allPredictedContinuations.Select(v => v.ElementAt(i)); 98 // for (int h = 0; h < horizon; h++) { 99 // OnlineCalculatorError errorState; 100 // meanCalculator.Add(OnlineMeanSquaredErrorCalculator.Calculate(predictedContinuations 101 // .Select(x => x.ElementAt(h)) 102 // .LimitToRange(lowerEstimationLimit, 103 // upperEstimationLimit), 104 // actualContinuations.Select(x => x.ElementAt(h)), 105 // out errorState)); 106 // if (errorState != OnlineCalculatorError.None) return double.NaN; 107 // } 108 //} 95 109 96 return meanCalculator.MeanErrorState == OnlineCalculatorError.None ? meanCalculator.Mean : double.MaxValue; 110 97 } -
branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis/3.4/SingleObjective/SymbolicTimeSeriesPrognosisSingleObjectiveProblem.cs
r7154 r7183 76 76 private void InitializeOperators() { 77 77 Operators.Add(new SymbolicTimeSeriesPrognosisSingleObjectiveTrainingBestSolutionAnalyzer()); 78 //Operators.Add(new SymbolicTimeSeriesPrognosisSingleObjectiveValidationBestSolutionAnalyzer());79 //Operators.Add(new SymbolicTimeSeriesPrognosisSingleObjectiveOverfittingAnalyzer());78 Operators.Add(new SymbolicTimeSeriesPrognosisSingleObjectiveValidationBestSolutionAnalyzer()); 79 Operators.Add(new SymbolicTimeSeriesPrognosisSingleObjectiveOverfittingAnalyzer()); 80 80 ParameterizeOperators(); 81 81 } 82 82 83 83 private void UpdateEstimationLimits() { 84 //if (ProblemData.TrainingIndizes.Any()) {85 // var targetValues = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariables, ProblemData.TrainingIndizes).ToList();86 // var mean = targetValues.Average();87 // var range = targetValues.Max() - targetValues.Min();88 // EstimationLimits.Upper = mean + PunishmentFactor * range;89 // EstimationLimits.Lower = mean - PunishmentFactor * range;90 //} else {91 84 EstimationLimits.Upper = double.MaxValue; 92 85 EstimationLimits.Lower = double.MinValue; 93 //}94 86 } 95 87 … … 106 98 op.EstimationLimitsParameter.ActualName = EstimationLimitsParameter.Name; 107 99 } 108 foreach (var op in operators.OfType<SymbolicTimeSeriesPrognosisSingleObjectiveTrainingBestSolutionAnalyzer>()) 109 { 100 foreach (var op in operators.OfType<SymbolicTimeSeriesPrognosisSingleObjectiveTrainingBestSolutionAnalyzer>()) { 110 101 op.MaximizationParameter.ActualName = MaximizationParameter.Name; 111 102 op.ProblemDataParameter.ActualName = ProblemDataParameter.Name; -
branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis/3.4/SingleObjective/SymbolicTimeSeriesPrognosisSingleObjectiveTrainingBestSolutionAnalyzer.cs
r7120 r7183 76 76 77 77 protected override ISymbolicTimeSeriesPrognosisSolution CreateSolution(ISymbolicExpressionTree bestTree, double bestQuality) { 78 var model = new SymbolicTimeSeriesPrognosisModel((ISymbolicExpressionTree)bestTree.Clone(), SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, ProblemDataParameter.ActualValue.TargetVariables.ToArray() );78 var model = new SymbolicTimeSeriesPrognosisModel((ISymbolicExpressionTree)bestTree.Clone(), SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, ProblemDataParameter.ActualValue.TargetVariables.ToArray(), EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper); 79 79 if (ApplyLinearScaling.Value) 80 80 SymbolicTimeSeriesPrognosisModel.Scale(model, ProblemDataParameter.ActualValue); -
branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis/3.4/SingleObjective/SymbolicTimeSeriesPrognosisSingleObjectiveValidationBestSolutionAnalyzer.cs
r7100 r7183 20 20 #endregion 21 21 22 using System.Linq; 22 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Core; … … 33 34 [Item("SymbolicTimeSeriesPrognosisSingleObjectiveValidationBestSolutionAnalyzer", "An operator that analyzes the validation best symbolic time-series prognosis solution for single objective symbolic time-series prognosis problems.")] 34 35 [StorableClass] 35 public sealed class SymbolicTimeSeriesPrognosisSingleObjectiveValidationBestSolutionAnalyzer : SymbolicDataAnalysisSingleObjectiveValidationBestSolutionAnalyzer<ISymbolicTimeSeriesPrognosisSolution, ISymbolicTimeSeriesPrognosisSingleObjectiveEvaluator, ITimeSeriesPrognosisProblemData>, 36 ISymbolicDataAnalysisBoundedOperator { 36 public sealed class SymbolicTimeSeriesPrognosisSingleObjectiveValidationBestSolutionAnalyzer : SymbolicDataAnalysisSingleObjectiveValidationBestSolutionAnalyzer<ISymbolicTimeSeriesPrognosisSolution, ISymbolicTimeSeriesPrognosisSingleObjectiveEvaluator, ITimeSeriesPrognosisProblemData>, ISymbolicDataAnalysisBoundedOperator { 37 37 private const string EstimationLimitsParameterName = "EstimationLimits"; 38 38 private const string ApplyLinearScalingParameterName = "ApplyLinearScaling"; 39 40 39 #region parameter properties 41 40 public IValueLookupParameter<DoubleLimit> EstimationLimitsParameter { … … 61 60 Parameters.Add(new ValueParameter<BoolValue>(ApplyLinearScalingParameterName, "Flag that indicates if the produced symbolic regression solution should be linearly scaled.", new BoolValue(true))); 62 61 } 63 64 62 public override IDeepCloneable Clone(Cloner cloner) { 65 63 return new SymbolicTimeSeriesPrognosisSingleObjectiveValidationBestSolutionAnalyzer(this, cloner); … … 67 65 68 66 protected override ISymbolicTimeSeriesPrognosisSolution CreateSolution(ISymbolicExpressionTree bestTree, double bestQuality) { 69 var model = new SymbolicTimeSeriesPrognosisModel((ISymbolicExpressionTree)bestTree.Clone(), Symbolic TimeSeriesPrognosisInterpreterParameter.ActualValue);67 var model = new SymbolicTimeSeriesPrognosisModel((ISymbolicExpressionTree)bestTree.Clone(), SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, ProblemDataParameter.ActualValue.TargetVariables.ToArray(), EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper); 70 68 if (ApplyLinearScaling.Value) 71 69 SymbolicTimeSeriesPrognosisModel.Scale(model, ProblemDataParameter.ActualValue); -
branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis/3.4/SymbolicTimeSeriesPrognosisModel.cs
r7154 r7183 39 39 get { return HeuristicLab.Common.Resources.VSImageLibrary.Function; } 40 40 } 41 [Storable(DefaultValue = double.MinValue)] 42 private double lowerEstimationLimit; 43 [Storable(DefaultValue = double.MaxValue)] 44 private double upperEstimationLimit; 41 45 42 46 #region properties … … 72 76 this.targetVariables = new string[original.targetVariables.Length]; 73 77 Array.Copy(original.targetVariables, this.targetVariables, this.targetVariables.Length); 74 } 75 public SymbolicTimeSeriesPrognosisModel(ISymbolicExpressionTree tree, ISymbolicTimeSeriesPrognosisExpressionTreeInterpreter interpreter, IEnumerable<string> targetVariables) 78 this.lowerEstimationLimit = original.lowerEstimationLimit; 79 this.upperEstimationLimit = original.upperEstimationLimit; 80 } 81 public SymbolicTimeSeriesPrognosisModel(ISymbolicExpressionTree tree, ISymbolicTimeSeriesPrognosisExpressionTreeInterpreter interpreter, IEnumerable<string> targetVariables, double lowerLimit = double.MinValue, double upperLimit = double.MaxValue) 76 82 : base() { 77 83 this.name = ItemName; … … 79 85 this.symbolicExpressionTree = tree; 80 86 this.interpreter = interpreter; this.targetVariables = targetVariables.ToArray(); 87 this.lowerEstimationLimit = lowerLimit; 88 this.upperEstimationLimit = upperLimit; 81 89 } 82 90 … … 95 103 for (int c = 0; c < components.Length; c++) { 96 104 enumerator.MoveNext(); 97 components[c] = enumerator.Current;105 components[c] = Math.Min(upperEstimationLimit, Math.Max(lowerEstimationLimit, enumerator.Current)); 98 106 } 99 107 l.Add(components); -
branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.cs
r6803 r7183 107 107 if (tree.Root.SubtreeCount > 1) 108 108 this.treeChart.Tree = new SymbolicExpressionTree(tree.Root); // RPB + ADFs 109 else if (tree.Root.GetSubtree(0).SubtreeCount > 1) 110 this.treeChart.Tree = new SymbolicExpressionTree(tree.Root); // RPB 109 111 else 110 112 this.treeChart.Tree = new SymbolicExpressionTree(tree.Root.GetSubtree(0).GetSubtree(0)); // 1st child of RPB … … 139 141 if (tree.Root.SubtreeCount > 1) 140 142 this.treeChart.Tree = new SymbolicExpressionTree(tree.Root); // RPB + ADFs 143 else if (tree.Root.GetSubtree(0).SubtreeCount > 1) 144 this.treeChart.Tree = new SymbolicExpressionTree(tree.Root); // RPB 141 145 else 142 146 this.treeChart.Tree = new SymbolicExpressionTree(tree.Root.GetSubtree(0).GetSubtree(0)); // 1st child of RPB -
branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis.Views/3.4/Solution Views/TimeSeriesPrognosisSolutionView.Designer.cs
r7160 r7183 75 75 // itemsListView 76 76 // 77 this.itemsListView.Size = new System.Drawing.Size(244, 240);77 this.itemsListView.Size = new System.Drawing.Size(244, 153); 78 78 // 79 79 // detailsGroupBox 80 80 // 81 this.detailsGroupBox.Size = new System.Drawing.Size(266, 248);81 this.detailsGroupBox.Size = new System.Drawing.Size(266, 161); 82 82 // 83 83 // addButton … … 91 91 // viewHost 92 92 // 93 this.viewHost.Size = new System.Drawing.Size(254, 223);93 this.viewHost.Size = new System.Drawing.Size(254, 136); 94 94 // 95 95 // horizonTextBox … … 99 99 this.horizonTextBox.Size = new System.Drawing.Size(100, 20); 100 100 this.horizonTextBox.TabIndex = 1; 101 this.horizonTextBox.KeyDown += new System.Windows.Forms.KeyEventHandler(this.horizonTextBox_KeyDown); 101 102 this.horizonTextBox.Validating += new System.ComponentModel.CancelEventHandler(this.horizonTextBox_Validating); 102 103 this.horizonTextBox.Validated += new System.EventHandler(this.horizonTextBox_Validated); -
branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis.Views/3.4/Solution Views/TimeSeriesPrognosisSolutionView.cs
r7160 r7183 73 73 Content.Horizon = val; 74 74 } 75 76 private void horizonTextBox_KeyDown(object sender, KeyEventArgs e) { 77 if (e.KeyCode == Keys.Enter) { 78 e.Handled = true; 79 this.Focus(); 80 } else { 81 e.Handled = false; 82 } 83 } 84 75 85 } 76 86 } -
branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/TimeSeriesPrognosis/TimeSeriesPrognosisSolutionBase.cs
r7160 r7183 20 20 #endregion 21 21 22 using System; 22 23 using System.Collections.Concurrent; 23 24 using System.Collections.Generic; … … 195 196 private void AfterDeserialization() { 196 197 if (horizon == 0) horizon = 1; 198 bool anyNewResult = false; 199 if (!ContainsKey(TrainingTheilsUStatisticLastResultName)) { 200 Add(new Result(TrainingTheilsUStatisticLastResultName, "The average Theil's U statistic (reference: previous value) of the forecasts of the model on the training partition", new DoubleArray())); 201 anyNewResult = true; 202 } 203 if (!ContainsKey(TestTheilsUStatisticLastResultName)) { 204 Add(new Result(TestTheilsUStatisticLastResultName, "The average Theil's U statistic (reference: previous value) of the forecasts of the model on the test partition", new DoubleArray())); 205 anyNewResult = true; 206 } 207 if (!ContainsKey(TrainingTheilsUStatisticMeanResultName)) { 208 Add(new Result(TrainingTheilsUStatisticMeanResultName, "The average Theil's U statistic (reference: mean value) of the forecasts of the model on the training partition", new DoubleArray())); 209 anyNewResult = true; 210 } 211 if (!ContainsKey(TestTheilsUStatisticMeanResultName)) { 212 Add(new Result(TestTheilsUStatisticMeanResultName, "The average Theil's U statistic (reference: mean value) of the forecasts of the model on the test partition", new DoubleArray())); 213 anyNewResult = true; 214 } 215 if (!ContainsKey(TrainingTheilsUStatisticMAResultName)) { 216 Add(new Result(TrainingTheilsUStatisticMAResultName, "The average Theil's U statistic (reference: moving average) of the forecasts of the model on the training partition", new DoubleArray())); 217 anyNewResult = true; 218 } 219 if (!ContainsKey(TestTheilsUStatisticMAResultName)) { 220 Add(new Result(TestTheilsUStatisticMAResultName, "The average Theil's U statistic (reference: moving average) of the forecasts of the model on the test partition", new DoubleArray())); 221 anyNewResult = true; 222 } 223 if (anyNewResult) 224 RecalculateResults(); 197 225 } 198 226 … … 240 268 //double[] trainingTheilsU = new double[targetVariables.Length]; 241 269 //double[] testTheilsU = new double[targetVariables.Length]; 270 271 var trainingMseCalculators = new OnlineMeanSquaredErrorCalculator[targetVariables.Length]; 272 var testMseCalculators = new OnlineMeanSquaredErrorCalculator[targetVariables.Length]; 273 var trainingMaeCalculators = new OnlineMeanAbsoluteErrorCalculator[targetVariables.Length]; 274 var testMaeCalculators = new OnlineMeanAbsoluteErrorCalculator[targetVariables.Length]; 275 var trainingRSquaredCalculators = new OnlinePearsonsRSquaredCalculator[targetVariables.Length]; 276 var testRSquaredCalculators = new OnlinePearsonsRSquaredCalculator[targetVariables.Length]; 277 var trainingRelErrorCalculators = new OnlineMeanAbsolutePercentageErrorCalculator[targetVariables.Length]; 278 var testRelErrorCalculators = new OnlineMeanAbsolutePercentageErrorCalculator[targetVariables.Length]; 279 var trainingNmseCalculators = new OnlineNormalizedMeanSquaredErrorCalculator[targetVariables.Length]; 280 var testNmseCalculators = new OnlineNormalizedMeanSquaredErrorCalculator[targetVariables.Length]; 242 281 243 282 var trainingDsCalculators = new OnlineDirectionalSymmetryCalculator[targetVariables.Length]; … … 252 291 var testTheilsUMovingAverageCalculators = new OnlineTheilsUStatisticCalculator[targetVariables.Length]; 253 292 for (int i = 0; i < targetVariables.Length; i++) { 293 trainingMseCalculators[i] = new OnlineMeanSquaredErrorCalculator(); 294 testMseCalculators[i] = new OnlineMeanSquaredErrorCalculator(); 295 trainingMaeCalculators[i] = new OnlineMeanAbsoluteErrorCalculator(); 296 testMaeCalculators[i] = new OnlineMeanAbsoluteErrorCalculator(); 297 trainingRSquaredCalculators[i] = new OnlinePearsonsRSquaredCalculator(); 298 testRSquaredCalculators[i] = new OnlinePearsonsRSquaredCalculator(); 299 trainingRelErrorCalculators[i] = new OnlineMeanAbsolutePercentageErrorCalculator(); 300 testRelErrorCalculators[i] = new OnlineMeanAbsolutePercentageErrorCalculator(); 301 trainingNmseCalculators[i] = new OnlineNormalizedMeanSquaredErrorCalculator(); 302 testNmseCalculators[i] = new OnlineNormalizedMeanSquaredErrorCalculator(); 303 254 304 trainingDsCalculators[i] = new OnlineDirectionalSymmetryCalculator(); 255 305 testDsCalculators[i] = new OnlineDirectionalSymmetryCalculator(); … … 286 336 trainingTheilsUMeanCalculators[t].Add(startValue, actualContinuation.Select(x => mean), actualContinuation, prognosedContinuation); 287 337 trainingTheilsUMovingAverageCalculators[t].Add(startValue, movingAverageContinuation, actualContinuation, prognosedContinuation); 338 339 var actualContinuationEnumerator = actualContinuation.GetEnumerator(); 340 var prognosedContinuationEnumerator = prognosedContinuation.GetEnumerator(); 341 while (actualContinuationEnumerator.MoveNext() & prognosedContinuationEnumerator.MoveNext()) { 342 trainingMseCalculators[t].Add(actualContinuationEnumerator.Current, prognosedContinuationEnumerator.Current); 343 trainingMaeCalculators[t].Add(actualContinuationEnumerator.Current, prognosedContinuationEnumerator.Current); 344 trainingRelErrorCalculators[t].Add(actualContinuationEnumerator.Current, prognosedContinuationEnumerator.Current); 345 trainingRSquaredCalculators[t].Add(actualContinuationEnumerator.Current, prognosedContinuationEnumerator.Current); 346 trainingNmseCalculators[t].Add(actualContinuationEnumerator.Current, prognosedContinuationEnumerator.Current); 347 } 348 if (actualContinuationEnumerator.MoveNext() | prognosedContinuationEnumerator.MoveNext()) 349 throw new ArgumentException( 350 "Different number of elements in Actual continuation and prognosed continuation."); 288 351 } 289 352 } … … 312 375 testTheilsUMeanCalculators[t].Add(startValue, actualContinuation.Select(x => mean), actualContinuation, prognosedContinuation); 313 376 testTheilsUMovingAverageCalculators[t].Add(startValue, movingAverageContinuation, actualContinuation, prognosedContinuation); 377 378 var actualContinuationEnumerator = actualContinuation.GetEnumerator(); 379 var prognosedContinuationEnumerator = prognosedContinuation.GetEnumerator(); 380 while (actualContinuationEnumerator.MoveNext() & prognosedContinuationEnumerator.MoveNext()) { 381 testMseCalculators[t].Add(actualContinuationEnumerator.Current, prognosedContinuationEnumerator.Current); 382 testMaeCalculators[t].Add(actualContinuationEnumerator.Current, prognosedContinuationEnumerator.Current); 383 testRelErrorCalculators[t].Add(actualContinuationEnumerator.Current, prognosedContinuationEnumerator.Current); 384 testRSquaredCalculators[t].Add(actualContinuationEnumerator.Current, prognosedContinuationEnumerator.Current); 385 testNmseCalculators[t].Add(actualContinuationEnumerator.Current, prognosedContinuationEnumerator.Current); 386 } 387 if (actualContinuationEnumerator.MoveNext() | prognosedContinuationEnumerator.MoveNext()) 388 throw new ArgumentException( 389 "Different number of elements in Actual continuation and prognosed continuation."); 314 390 } 315 391 } 316 392 } 317 393 394 395 TrainingMeanSquaredError = trainingMseCalculators.Select(c => c.ErrorState == OnlineCalculatorError.None ? c.Value : double.PositiveInfinity) 396 .ToArray(); 397 TestMeanSquaredError = testMseCalculators.Select(c => c.ErrorState == OnlineCalculatorError.None ? c.Value : double.PositiveInfinity) 398 .ToArray(); 399 TrainingMeanAbsoluteError = trainingMaeCalculators.Select(c => c.ErrorState == OnlineCalculatorError.None ? c.Value : double.PositiveInfinity) 400 .ToArray(); 401 TestMeanAbsoluteError = testMaeCalculators.Select(c => c.ErrorState == OnlineCalculatorError.None ? c.Value : double.PositiveInfinity) 402 .ToArray(); 403 TrainingRelativeError = trainingRelErrorCalculators.Select(c => c.ErrorState == OnlineCalculatorError.None ? c.Value : double.PositiveInfinity) 404 .ToArray(); 405 TestRelativeError = testRelErrorCalculators.Select(c => c.ErrorState == OnlineCalculatorError.None ? c.Value : double.PositiveInfinity) 406 .ToArray(); 407 TrainingRSquared = trainingRSquaredCalculators.Select(c => c.ErrorState == OnlineCalculatorError.None ? c.Value : 0.0) 408 .ToArray(); 409 TestRSquared = testRSquaredCalculators.Select(c => c.ErrorState == OnlineCalculatorError.None ? c.Value : 0.0) 410 .ToArray(); 411 TrainingNormalizedMeanSquaredError = trainingNmseCalculators.Select(c => c.ErrorState == OnlineCalculatorError.None ? c.Value : double.PositiveInfinity) 412 .ToArray(); 413 TestNormalizedMeanSquaredError = testNmseCalculators.Select(c => c.ErrorState == OnlineCalculatorError.None ? c.Value : double.PositiveInfinity) 414 .ToArray(); 415 318 416 TrainingDirectionalSymmetry = trainingDsCalculators.Select(c => c.ErrorState == OnlineCalculatorError.None ? c.Value : 0.0) 319 417 .ToArray();
Note: See TracChangeset
for help on using the changeset viewer.