- Timestamp:
- 06/12/12 10:31:56 (13 years ago)
- Location:
- branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis/3.4
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis/3.4/Dataset.cs
r7842 r7989 193 193 if (values == null) throw new ArgumentException("The varialbe " + variableName + " is not a double variable."); 194 194 195 foreach (int index in rows) 196 yield return values[index]; 195 return rows.Select(index => values[index]); 197 196 } 198 197 -
branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis/3.4/DatasetExtensions.cs
r7154 r7989 20 20 #endregion 21 21 22 using System;23 22 using System.Collections.Generic; 24 using System.Linq;25 using System.Text;26 using HeuristicLab.PluginInfrastructure;27 23 28 24 namespace HeuristicLab.Problems.DataAnalysis { 29 25 public static class DatasetExtensions { 30 public static IEnumerable<double> GetVectorEnumerable(this Dataset ds, IEnumerable<string> targetVariables, IEnumerable<int> rows) {31 var vars = targetVariables.ToArray();32 var values = (from var in vars33 select ds.GetReadOnlyDoubleValues(var))34 .ToArray();35 36 foreach (var r in rows) {37 for (int i = 0; i < values.Length; i++)38 yield return values[i][r];39 }40 }41 42 26 public static IEnumerable<T> TakeEvery<T>(this IEnumerable<T> xs, int nth) { 43 27 int i = 0; -
branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/TimeSeriesPrognosis/TimeSeriesPrognosisProblemData.cs
r7886 r7989 33 33 [Item("TimeSeriesPrognosisProblemData", "Represents an item containing all data defining a time series prognosis problem.")] 34 34 public class TimeSeriesPrognosisProblemData : DataAnalysisProblemData, ITimeSeriesPrognosisProblemData { 35 protected const string TargetVariable sParameterName = "TargetVariables";35 protected const string TargetVariableParameterName = "TargetVariable"; 36 36 37 37 #region default data … … 1540 1540 private static readonly Dataset defaultDataset; 1541 1541 private static readonly IEnumerable<string> defaultAllowedInputVariables; 1542 private static readonly string [] defaultTargetVariables;1542 private static readonly string defaultTargetVariable; 1543 1543 1544 1544 private static readonly TimeSeriesPrognosisProblemData emptyProblemData; … … 1551 1551 defaultDataset.Name = "Mackey-Glass (t=17) Time Series Benchmark Dataset"; 1552 1552 defaultAllowedInputVariables = new List<string>() { "x" }; 1553 defaultTargetVariable s = new string[] { "x" };1553 defaultTargetVariable = "x"; 1554 1554 1555 1555 var problemData = new TimeSeriesPrognosisProblemData(); … … 1563 1563 problemData.Parameters.Add(new FixedValueParameter<IntRange>(TrainingPartitionParameterName, "", (IntRange)new IntRange(0, 0).AsReadOnly())); 1564 1564 problemData.Parameters.Add(new FixedValueParameter<IntRange>(TestPartitionParameterName, "", (IntRange)new IntRange(0, 0).AsReadOnly())); 1565 problemData.Parameters.Add(new ConstrainedValueParameter<StringValue>(TargetVariable sParameterName, new ItemSet<StringValue>()));1565 problemData.Parameters.Add(new ConstrainedValueParameter<StringValue>(TargetVariableParameterName, new ItemSet<StringValue>())); 1566 1566 emptyProblemData = problemData; 1567 1567 } 1568 1568 #endregion 1569 1569 1570 public ValueParameter<CheckedItemList<StringValue>> TargetVariablesParameter {1571 get { return ( ValueParameter<CheckedItemList<StringValue>>)Parameters[TargetVariablesParameterName]; }1570 public ConstrainedValueParameter<StringValue> TargetVariableParameter { 1571 get { return (ConstrainedValueParameter<StringValue>)Parameters[TargetVariableParameterName]; } 1572 1572 } 1573 public IEnumerable<string> TargetVariables{1574 get { return TargetVariable sParameter.Value.CheckedItems.Select(x => x.Value.Value); }1573 public string TargetVariable { 1574 get { return TargetVariableParameter.Value.Value; } 1575 1575 } 1576 1576 … … 1592 1592 1593 1593 public TimeSeriesPrognosisProblemData() 1594 : this(defaultDataset, defaultAllowedInputVariables, defaultTargetVariable s) {1594 : this(defaultDataset, defaultAllowedInputVariables, defaultTargetVariable) { 1595 1595 } 1596 1596 1597 public TimeSeriesPrognosisProblemData(Dataset dataset, IEnumerable<string> allowedInputVariables, IEnumerable<string> targetVariables)1597 public TimeSeriesPrognosisProblemData(Dataset dataset, IEnumerable<string> allowedInputVariables, string targetVariable) 1598 1598 : base(dataset, allowedInputVariables) { 1599 1599 var variables = InputVariables.Select(x => x.AsReadOnly()).ToList(); 1600 var targetVariablesList = new CheckedItemList<StringValue>(variables); 1601 foreach (var targetVar in targetVariables) { 1602 targetVariablesList.SetItemCheckedState(targetVariablesList.Single(x => x.Value == targetVar), true); 1603 } 1604 Parameters.Add(new FixedValueParameter<CheckedItemList<StringValue>>(TargetVariablesParameterName, targetVariablesList)); 1600 Parameters.Add(new ConstrainedValueParameter<StringValue>(TargetVariableParameterName, new ItemSet<StringValue>(variables), variables.First(x => x.Value == targetVariable))); 1605 1601 RegisterParameterEvents(); 1606 1602 } 1607 1603 1608 1604 private void RegisterParameterEvents() { 1609 TargetVariable sParameter.Value.CheckedItemsChanged += TargetVariableParameter_ValueChanged;1605 TargetVariableParameter.ValueChanged += new EventHandler(TargetVariableParameter_ValueChanged); 1610 1606 } 1611 1612 1607 private void TargetVariableParameter_ValueChanged(object sender, EventArgs e) { 1613 1608 OnChanged(); -
branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/TimeSeriesPrognosis/TimeSeriesPrognosisSolution.cs
r7160 r7989 21 21 22 22 using System.Collections.Generic; 23 using System.Linq;24 23 using HeuristicLab.Common; 25 24 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; … … 33 32 34 33 [StorableConstructor] 35 protected TimeSeriesPrognosisSolution(bool deserializing) 36 : base(deserializing) { 37 } 38 protected TimeSeriesPrognosisSolution(TimeSeriesPrognosisSolution original, Cloner cloner) 39 : base(original, cloner) { 40 } 41 protected TimeSeriesPrognosisSolution(ITimeSeriesPrognosisModel model, ITimeSeriesPrognosisProblemData problemData) 42 : base(model, problemData) { 43 } 34 protected TimeSeriesPrognosisSolution(bool deserializing) : base(deserializing) { } 35 protected TimeSeriesPrognosisSolution(TimeSeriesPrognosisSolution original, Cloner cloner) : base(original, cloner) { } 36 protected TimeSeriesPrognosisSolution(ITimeSeriesPrognosisModel model, ITimeSeriesPrognosisProblemData problemData) : base(model, problemData) { } 44 37 45 38 protected override void RecalculateResults() { … … 47 40 } 48 41 49 public override IEnumerable<IEnumerable<double>> PrognosedTrainingValues { 50 get { 51 return GetPrognosedValues(ProblemData.TrainingIndizes.Take(1), 52 ProblemData.TrainingPartition.End - ProblemData.TrainingPartition.Start) 53 .First(); 54 } 55 } 56 public override IEnumerable<IEnumerable<double>> PrognosedTestValues { 57 get { 58 return GetPrognosedValues(ProblemData.TestIndizes.Take(1), 59 ProblemData.TestPartition.End - ProblemData.TestPartition.Start) 60 .First(); 61 } 62 } 63 public override IEnumerable<IEnumerable<IEnumerable<double>>> GetPrognosedValues(IEnumerable<int> rows, int horizon) { 42 public override IEnumerable<IEnumerable<double>> GetPrognosedValues(IEnumerable<int> rows, int horizon) { 64 43 return Model.GetPrognosedValues(ProblemData.Dataset, rows, horizon); 65 }66 67 protected override void OnProblemDataChanged() {68 base.OnProblemDataChanged();69 }70 71 protected override void OnModelChanged() {72 base.OnModelChanged();73 44 } 74 45 } -
branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/TimeSeriesPrognosis/TimeSeriesPrognosisSolutionBase.cs
r7194 r7989 21 21 22 22 using System; 23 using System.Collections.Concurrent;24 23 using System.Collections.Generic; 25 24 using System.Linq; … … 75 74 } 76 75 77 public abstract IEnumerable<IEnumerable<double>> PrognosedTrainingValues { get; } 78 public abstract IEnumerable<IEnumerable<double>> PrognosedTestValues { get; } 79 public abstract IEnumerable<IEnumerable<IEnumerable<double>>> GetPrognosedValues(IEnumerable<int> rows, int horizon); 76 public abstract IEnumerable<IEnumerable<double>> GetPrognosedValues(IEnumerable<int> rows, int horizon); 80 77 81 78 #region Results 82 public double []TrainingMeanSquaredError {83 get { return ((Double Array)this[TrainingMeanSquaredErrorResultName].Value).ToArray(); }84 private set { this[TrainingMeanSquaredErrorResultName].Value = new DoubleArray(value); }85 } 86 public double []TestMeanSquaredError {87 get { return ((Double Array)this[TestMeanSquaredErrorResultName].Value).ToArray(); }88 private set { this[TestMeanSquaredErrorResultName].Value = new DoubleArray(value); }89 } 90 public double []TrainingMeanAbsoluteError {91 get { return ((Double Array)this[TrainingMeanAbsoluteErrorResultName].Value).ToArray(); }92 private set { this[TrainingMeanAbsoluteErrorResultName].Value = new DoubleArray(value); }93 } 94 public double []TestMeanAbsoluteError {95 get { return ((Double Array)this[TestMeanAbsoluteErrorResultName].Value).ToArray(); }96 private set { this[TestMeanAbsoluteErrorResultName].Value = new DoubleArray(value); }97 } 98 public double []TrainingRSquared {99 get { return ((Double Array)this[TrainingSquaredCorrelationResultName].Value).ToArray(); }100 private set { this[TrainingSquaredCorrelationResultName].Value = new DoubleArray(value); }101 } 102 public double []TestRSquared {103 get { return ((Double Array)this[TestSquaredCorrelationResultName].Value).ToArray(); }104 private set { this[TestSquaredCorrelationResultName].Value = new DoubleArray(value); }105 } 106 public double []TrainingRelativeError {107 get { return ((Double Array)this[TrainingRelativeErrorResultName].Value).ToArray(); }108 private set { this[TrainingRelativeErrorResultName].Value = new DoubleArray(value); }109 } 110 public double []TestRelativeError {111 get { return ((Double Array)this[TestRelativeErrorResultName].Value).ToArray(); }112 private set { this[TestRelativeErrorResultName].Value = new DoubleArray(value); }113 } 114 public double []TrainingNormalizedMeanSquaredError {115 get { return ((Double Array)this[TrainingNormalizedMeanSquaredErrorResultName].Value).ToArray(); }116 private set { this[TrainingNormalizedMeanSquaredErrorResultName].Value = new DoubleArray(value); }117 } 118 public double []TestNormalizedMeanSquaredError {119 get { return ((Double Array)this[TestNormalizedMeanSquaredErrorResultName].Value).ToArray(); }120 private set { this[TestNormalizedMeanSquaredErrorResultName].Value = new DoubleArray(value); }121 } 122 public double []TrainingDirectionalSymmetry {123 get { return ((Double Array)this[TrainingDirectionalSymmetryResultName].Value).ToArray(); }124 private set { this[TrainingDirectionalSymmetryResultName].Value = new DoubleArray(value); }125 } 126 public double []TestDirectionalSymmetry {127 get { return ((Double Array)this[TestDirectionalSymmetryResultName].Value).ToArray(); }128 private set { this[TestDirectionalSymmetryResultName].Value = new DoubleArray(value); }129 } 130 public double []TrainingWeightedDirectionalSymmetry {131 get { return ((Double Array)this[TrainingWeightedDirectionalSymmetryResultName].Value).ToArray(); }132 private set { this[TrainingWeightedDirectionalSymmetryResultName].Value = new DoubleArray(value); }133 } 134 public double []TestWeightedDirectionalSymmetry {135 get { return ((Double Array)this[TestWeightedDirectionalSymmetryResultName].Value).ToArray(); }136 private set { this[TestWeightedDirectionalSymmetryResultName].Value = new DoubleArray(value); }137 } 138 public double []TrainingTheilsUStatisticLast {139 get { return ((Double Array)this[TrainingTheilsUStatisticLastResultName].Value).ToArray(); }140 private set { this[TrainingTheilsUStatisticLastResultName].Value = new DoubleArray(value); }141 } 142 public double []TestTheilsUStatisticLast {143 get { return ((Double Array)this[TestTheilsUStatisticLastResultName].Value).ToArray(); }144 private set { this[TestTheilsUStatisticLastResultName].Value = new DoubleArray(value); }145 } 146 public double []TrainingTheilsUStatisticMean {147 get { return ((Double Array)this[TrainingTheilsUStatisticMeanResultName].Value).ToArray(); }148 private set { this[TrainingTheilsUStatisticMeanResultName].Value = new DoubleArray(value); }149 } 150 public double []TestTheilsUStatisticMean {151 get { return ((Double Array)this[TestTheilsUStatisticMeanResultName].Value).ToArray(); }152 private set { this[TestTheilsUStatisticMeanResultName].Value = new DoubleArray(value); }153 } 154 public double []TrainingTheilsUStatisticMovingAverage {155 get { return ((Double Array)this[TrainingTheilsUStatisticMaResultName].Value).ToArray(); }156 private set { this[TrainingTheilsUStatisticMaResultName].Value = new DoubleArray(value); }157 } 158 public double []TestTheilsUStatisticMovingAverage {159 get { return ((Double Array)this[TestTheilsUStatisticMaResultName].Value).ToArray(); }160 private set { this[TestTheilsUStatisticMaResultName].Value = new DoubleArray(value); }79 public double TrainingMeanSquaredError { 80 get { return ((DoubleValue)this[TrainingMeanSquaredErrorResultName].Value).Value; } 81 private set { ((DoubleValue)this[TrainingMeanSquaredErrorResultName].Value).Value = value; } 82 } 83 public double TestMeanSquaredError { 84 get { return ((DoubleValue)this[TestMeanSquaredErrorResultName].Value).Value; } 85 private set { ((DoubleValue)this[TestMeanSquaredErrorResultName].Value).Value = value; } 86 } 87 public double TrainingMeanAbsoluteError { 88 get { return ((DoubleValue)this[TrainingMeanAbsoluteErrorResultName].Value).Value; } 89 private set { ((DoubleValue)this[TrainingMeanAbsoluteErrorResultName].Value).Value = value; } 90 } 91 public double TestMeanAbsoluteError { 92 get { return ((DoubleValue)this[TestMeanAbsoluteErrorResultName].Value).Value; } 93 private set { ((DoubleValue)this[TestMeanAbsoluteErrorResultName].Value).Value = value; } 94 } 95 public double TrainingRSquared { 96 get { return ((DoubleValue)this[TrainingSquaredCorrelationResultName].Value).Value; } 97 private set { ((DoubleValue)this[TrainingSquaredCorrelationResultName].Value).Value = value; } 98 } 99 public double TestRSquared { 100 get { return ((DoubleValue)this[TestSquaredCorrelationResultName].Value).Value; } 101 private set { ((DoubleValue)this[TestSquaredCorrelationResultName].Value).Value = value; } 102 } 103 public double TrainingRelativeError { 104 get { return ((DoubleValue)this[TrainingRelativeErrorResultName].Value).Value; } 105 private set { ((DoubleValue)this[TrainingRelativeErrorResultName].Value).Value = value; } 106 } 107 public double TestRelativeError { 108 get { return ((DoubleValue)this[TestRelativeErrorResultName].Value).Value; } 109 private set { ((DoubleValue)this[TestRelativeErrorResultName].Value).Value = value; } 110 } 111 public double TrainingNormalizedMeanSquaredError { 112 get { return ((DoubleValue)this[TrainingNormalizedMeanSquaredErrorResultName].Value).Value; } 113 private set { ((DoubleValue)this[TrainingNormalizedMeanSquaredErrorResultName].Value).Value = value; } 114 } 115 public double TestNormalizedMeanSquaredError { 116 get { return ((DoubleValue)this[TestNormalizedMeanSquaredErrorResultName].Value).Value; } 117 private set { ((DoubleValue)this[TestNormalizedMeanSquaredErrorResultName].Value).Value = value; } 118 } 119 public double TrainingDirectionalSymmetry { 120 get { return ((DoubleValue)this[TrainingDirectionalSymmetryResultName].Value).Value; } 121 private set { ((DoubleValue)this[TrainingDirectionalSymmetryResultName].Value).Value = value; } 122 } 123 public double TestDirectionalSymmetry { 124 get { return ((DoubleValue)this[TestDirectionalSymmetryResultName].Value).Value; } 125 private set { ((DoubleValue)this[TestDirectionalSymmetryResultName].Value).Value = value; } 126 } 127 public double TrainingWeightedDirectionalSymmetry { 128 get { return ((DoubleValue)this[TrainingWeightedDirectionalSymmetryResultName].Value).Value; } 129 private set { ((DoubleValue)this[TrainingWeightedDirectionalSymmetryResultName].Value).Value = value; } 130 } 131 public double TestWeightedDirectionalSymmetry { 132 get { return ((DoubleValue)this[TestWeightedDirectionalSymmetryResultName].Value).Value; } 133 private set { ((DoubleValue)this[TestWeightedDirectionalSymmetryResultName].Value).Value = value; } 134 } 135 public double TrainingTheilsUStatisticLast { 136 get { return ((DoubleValue)this[TrainingTheilsUStatisticLastResultName].Value).Value; } 137 private set { ((DoubleValue)this[TrainingTheilsUStatisticLastResultName].Value).Value = value; } 138 } 139 public double TestTheilsUStatisticLast { 140 get { return ((DoubleValue)this[TestTheilsUStatisticLastResultName].Value).Value; } 141 private set { ((DoubleValue)this[TestTheilsUStatisticLastResultName].Value).Value = value; } 142 } 143 public double TrainingTheilsUStatisticMean { 144 get { return ((DoubleValue)this[TrainingTheilsUStatisticMeanResultName].Value).Value; } 145 private set { ((DoubleValue)this[TrainingTheilsUStatisticMeanResultName].Value).Value = value; } 146 } 147 public double TestTheilsUStatisticMean { 148 get { return ((DoubleValue)this[TestTheilsUStatisticMeanResultName].Value).Value; } 149 private set { ((DoubleValue)this[TestTheilsUStatisticMeanResultName].Value).Value = value; } 150 } 151 public double TrainingTheilsUStatisticMovingAverage { 152 get { return ((DoubleValue)this[TrainingTheilsUStatisticMaResultName].Value).Value; } 153 private set { ((DoubleValue)this[TrainingTheilsUStatisticMaResultName].Value).Value = value; } 154 } 155 public double TestTheilsUStatisticMovingAverage { 156 get { return ((DoubleValue)this[TestTheilsUStatisticMaResultName].Value).Value; } 157 private set { ((DoubleValue)this[TestTheilsUStatisticMaResultName].Value).Value = value; } 161 158 } 162 159 #endregion … … 170 167 protected TimeSeriesPrognosisSolutionBase(ITimeSeriesPrognosisModel model, ITimeSeriesPrognosisProblemData problemData) 171 168 : base(model, problemData) { 172 Add(new Result(TrainingMeanSquaredErrorResultName, "Mean of squared errors of the model on the training partition", new Double Array()));173 Add(new Result(TestMeanSquaredErrorResultName, "Mean of squared errors of the model on the test partition", new Double Array()));174 Add(new Result(TrainingMeanAbsoluteErrorResultName, "Mean of absolute errors of the model on the training partition", new Double Array()));175 Add(new Result(TestMeanAbsoluteErrorResultName, "Mean of absolute errors of the model on the test partition", new Double Array()));176 Add(new Result(TrainingSquaredCorrelationResultName, "Squared Pearson's correlation coefficient of the model output and the actual values on the training partition", new Double Array()));177 Add(new Result(TestSquaredCorrelationResultName, "Squared Pearson's correlation coefficient of the model output and the actual values on the test partition", new Double Array()));178 Add(new Result(TrainingRelativeErrorResultName, "Average of the relative errors of the model output and the actual values on the training partition", new Double Array()));179 Add(new Result(TestRelativeErrorResultName, "Average of the relative errors of the model output and the actual values on the test partition", new Double Array()));180 Add(new Result(TrainingNormalizedMeanSquaredErrorResultName, "Normalized mean of squared errors of the model on the training partition", new Double Array()));181 Add(new Result(TestNormalizedMeanSquaredErrorResultName, "Normalized mean of squared errors of the model on the test partition", new Double Array()));182 Add(new Result(TrainingDirectionalSymmetryResultName, "The average directional symmetry of the forecasts of the model on the training partition", new Double Array()));183 Add(new Result(TestDirectionalSymmetryResultName, "The average directional symmetry of the forecasts of the model on the test partition", new Double Array()));184 Add(new Result(TrainingWeightedDirectionalSymmetryResultName, "The average weighted directional symmetry of the forecasts of the model on the training partition", new Double Array()));185 Add(new Result(TestWeightedDirectionalSymmetryResultName, "The average weighted directional symmetry of the forecasts of the model on the test partition", new Double Array()));186 Add(new Result(TrainingTheilsUStatisticLastResultName, "The average Theil's U statistic (reference: previous value) of the forecasts of the model on the training partition", new Double Array()));187 Add(new Result(TestTheilsUStatisticLastResultName, "The average Theil's U statistic (reference: previous value) of the forecasts of the model on the test partition", new Double Array()));188 Add(new Result(TrainingTheilsUStatisticMeanResultName, "The average Theil's U statistic (reference: mean value) of the forecasts of the model on the training partition", new Double Array()));189 Add(new Result(TestTheilsUStatisticMeanResultName, "The average Theil's U statistic (reference: mean value) of the forecasts of the model on the test partition", new Double Array()));190 Add(new Result(TrainingTheilsUStatisticMaResultName, "The average Theil's U statistic (reference: moving average) of the forecasts of the model on the training partition", new Double Array()));191 Add(new Result(TestTheilsUStatisticMaResultName, "The average Theil's U statistic (reference: moving average) of the forecasts of the model on the test partition", new Double Array()));169 Add(new Result(TrainingMeanSquaredErrorResultName, "Mean of squared errors of the model on the training partition", new DoubleValue())); 170 Add(new Result(TestMeanSquaredErrorResultName, "Mean of squared errors of the model on the test partition", new DoubleValue())); 171 Add(new Result(TrainingMeanAbsoluteErrorResultName, "Mean of absolute errors of the model on the training partition", new DoubleValue())); 172 Add(new Result(TestMeanAbsoluteErrorResultName, "Mean of absolute errors of the model on the test partition", new DoubleValue())); 173 Add(new Result(TrainingSquaredCorrelationResultName, "Squared Pearson's correlation coefficient of the model output and the actual values on the training partition", new DoubleValue())); 174 Add(new Result(TestSquaredCorrelationResultName, "Squared Pearson's correlation coefficient of the model output and the actual values on the test partition", new DoubleValue())); 175 Add(new Result(TrainingRelativeErrorResultName, "Average of the relative errors of the model output and the actual values on the training partition", new DoubleValue())); 176 Add(new Result(TestRelativeErrorResultName, "Average of the relative errors of the model output and the actual values on the test partition", new DoubleValue())); 177 Add(new Result(TrainingNormalizedMeanSquaredErrorResultName, "Normalized mean of squared errors of the model on the training partition", new DoubleValue())); 178 Add(new Result(TestNormalizedMeanSquaredErrorResultName, "Normalized mean of squared errors of the model on the test partition", new DoubleValue())); 179 Add(new Result(TrainingDirectionalSymmetryResultName, "The average directional symmetry of the forecasts of the model on the training partition", new DoubleValue())); 180 Add(new Result(TestDirectionalSymmetryResultName, "The average directional symmetry of the forecasts of the model on the test partition", new DoubleValue())); 181 Add(new Result(TrainingWeightedDirectionalSymmetryResultName, "The average weighted directional symmetry of the forecasts of the model on the training partition", new DoubleValue())); 182 Add(new Result(TestWeightedDirectionalSymmetryResultName, "The average weighted directional symmetry of the forecasts of the model on the test partition", new DoubleValue())); 183 Add(new Result(TrainingTheilsUStatisticLastResultName, "The average Theil's U statistic (reference: previous value) of the forecasts of the model on the training partition", new DoubleValue())); 184 Add(new Result(TestTheilsUStatisticLastResultName, "The average Theil's U statistic (reference: previous value) of the forecasts of the model on the test partition", new DoubleValue())); 185 Add(new Result(TrainingTheilsUStatisticMeanResultName, "The average Theil's U statistic (reference: mean value) of the forecasts of the model on the training partition", new DoubleValue())); 186 Add(new Result(TestTheilsUStatisticMeanResultName, "The average Theil's U statistic (reference: mean value) of the forecasts of the model on the test partition", new DoubleValue())); 187 Add(new Result(TrainingTheilsUStatisticMaResultName, "The average Theil's U statistic (reference: moving average) of the forecasts of the model on the training partition", new DoubleValue())); 188 Add(new Result(TestTheilsUStatisticMaResultName, "The average Theil's U statistic (reference: moving average) of the forecasts of the model on the test partition", new DoubleValue())); 192 189 horizon = 1; 193 190 } 194 191 195 [StorableHook(HookType.AfterDeserialization)]196 private void AfterDeserialization() {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();225 }226 192 227 193 protected void CalculateResults() { 228 string[] targetVariables = ProblemData.TargetVariables.ToArray(); 229 230 var trainingMseCalculators = new OnlineMeanSquaredErrorCalculator[targetVariables.Length]; 231 var testMseCalculators = new OnlineMeanSquaredErrorCalculator[targetVariables.Length]; 232 var trainingMaeCalculators = new OnlineMeanAbsoluteErrorCalculator[targetVariables.Length]; 233 var testMaeCalculators = new OnlineMeanAbsoluteErrorCalculator[targetVariables.Length]; 234 var trainingRSquaredCalculators = new OnlinePearsonsRSquaredCalculator[targetVariables.Length]; 235 var testRSquaredCalculators = new OnlinePearsonsRSquaredCalculator[targetVariables.Length]; 236 var trainingRelErrorCalculators = new OnlineMeanAbsolutePercentageErrorCalculator[targetVariables.Length]; 237 var testRelErrorCalculators = new OnlineMeanAbsolutePercentageErrorCalculator[targetVariables.Length]; 238 var trainingNmseCalculators = new OnlineNormalizedMeanSquaredErrorCalculator[targetVariables.Length]; 239 var testNmseCalculators = new OnlineNormalizedMeanSquaredErrorCalculator[targetVariables.Length]; 240 241 var trainingDsCalculators = new OnlineDirectionalSymmetryCalculator[targetVariables.Length]; 242 var testDsCalculators = new OnlineDirectionalSymmetryCalculator[targetVariables.Length]; 243 var trainingWdsCalculators = new OnlineWeightedDirectionalSymmetryCalculator[targetVariables.Length]; 244 var testWdsCalculators = new OnlineWeightedDirectionalSymmetryCalculator[targetVariables.Length]; 245 var trainingTheilsULastCalculators = new OnlineTheilsUStatisticCalculator[targetVariables.Length]; 246 var testTheilsULastCalculators = new OnlineTheilsUStatisticCalculator[targetVariables.Length]; 247 var trainingTheilsUMeanCalculators = new OnlineTheilsUStatisticCalculator[targetVariables.Length]; 248 var testTheilsUMeanCalculators = new OnlineTheilsUStatisticCalculator[targetVariables.Length]; 249 var trainingTheilsUMovingAverageCalculators = new OnlineTheilsUStatisticCalculator[targetVariables.Length]; 250 var testTheilsUMovingAverageCalculators = new OnlineTheilsUStatisticCalculator[targetVariables.Length]; 251 for (int i = 0; i < targetVariables.Length; i++) { 252 trainingMseCalculators[i] = new OnlineMeanSquaredErrorCalculator(); 253 testMseCalculators[i] = new OnlineMeanSquaredErrorCalculator(); 254 trainingMaeCalculators[i] = new OnlineMeanAbsoluteErrorCalculator(); 255 testMaeCalculators[i] = new OnlineMeanAbsoluteErrorCalculator(); 256 trainingRSquaredCalculators[i] = new OnlinePearsonsRSquaredCalculator(); 257 testRSquaredCalculators[i] = new OnlinePearsonsRSquaredCalculator(); 258 trainingRelErrorCalculators[i] = new OnlineMeanAbsolutePercentageErrorCalculator(); 259 testRelErrorCalculators[i] = new OnlineMeanAbsolutePercentageErrorCalculator(); 260 trainingNmseCalculators[i] = new OnlineNormalizedMeanSquaredErrorCalculator(); 261 testNmseCalculators[i] = new OnlineNormalizedMeanSquaredErrorCalculator(); 262 263 trainingDsCalculators[i] = new OnlineDirectionalSymmetryCalculator(); 264 testDsCalculators[i] = new OnlineDirectionalSymmetryCalculator(); 265 trainingWdsCalculators[i] = new OnlineWeightedDirectionalSymmetryCalculator(); 266 testWdsCalculators[i] = new OnlineWeightedDirectionalSymmetryCalculator(); 267 trainingTheilsULastCalculators[i] = new OnlineTheilsUStatisticCalculator(); 268 testTheilsULastCalculators[i] = new OnlineTheilsUStatisticCalculator(); 269 trainingTheilsUMeanCalculators[i] = new OnlineTheilsUStatisticCalculator(); 270 testTheilsUMeanCalculators[i] = new OnlineTheilsUStatisticCalculator(); 271 trainingTheilsUMovingAverageCalculators[i] = new OnlineTheilsUStatisticCalculator(); 272 testTheilsUMovingAverageCalculators[i] = new OnlineTheilsUStatisticCalculator(); 273 } 274 275 var allPrognosedTrainingValues = GetPrognosedValues(ProblemData.TrainingIndizes, horizon).GetEnumerator(); 276 double[] mean = new double[targetVariables.Length]; 277 for (int t = 0; t < targetVariables.Length; t++) { 278 double variance; 279 OnlineCalculatorError meanErrorState, varErrorState; 280 OnlineMeanAndVarianceCalculator.Calculate(ProblemData.Dataset.GetDoubleValues(targetVariables[t], ProblemData.TrainingIndizes), out mean[t], out variance, out meanErrorState, out varErrorState); 281 if (meanErrorState != OnlineCalculatorError.None) mean[t] = 0.0; 282 } 194 string targetVariable = ProblemData.TargetVariable; 195 196 var trainingMseCalculators = new OnlineMeanSquaredErrorCalculator(); 197 var testMseCalculators = new OnlineMeanSquaredErrorCalculator(); 198 var trainingMaeCalculators = new OnlineMeanAbsoluteErrorCalculator(); 199 var testMaeCalculators = new OnlineMeanAbsoluteErrorCalculator(); 200 var trainingRSquaredCalculators = new OnlinePearsonsRSquaredCalculator(); 201 var testRSquaredCalculators = new OnlinePearsonsRSquaredCalculator(); 202 var trainingRelErrorCalculators = new OnlineMeanAbsolutePercentageErrorCalculator(); 203 var testRelErrorCalculators = new OnlineMeanAbsolutePercentageErrorCalculator(); 204 var trainingNmseCalculators = new OnlineNormalizedMeanSquaredErrorCalculator(); 205 var testNmseCalculators = new OnlineNormalizedMeanSquaredErrorCalculator(); 206 207 var trainingDsCalculators = new OnlineDirectionalSymmetryCalculator(); 208 var testDsCalculators = new OnlineDirectionalSymmetryCalculator(); 209 var trainingWdsCalculators = new OnlineWeightedDirectionalSymmetryCalculator(); 210 var testWdsCalculators = new OnlineWeightedDirectionalSymmetryCalculator(); 211 var trainingTheilsULastCalculators = new OnlineTheilsUStatisticCalculator(); 212 var testTheilsULastCalculators = new OnlineTheilsUStatisticCalculator(); 213 var trainingTheilsUMeanCalculators = new OnlineTheilsUStatisticCalculator(); 214 var testTheilsUMeanCalculators = new OnlineTheilsUStatisticCalculator(); 215 var trainingTheilsUMovingAverageCalculators = new OnlineTheilsUStatisticCalculator(); 216 var testTheilsUMovingAverageCalculators = new OnlineTheilsUStatisticCalculator(); 217 218 double mean = ProblemData.Dataset.GetDoubleValues(targetVariable, ProblemData.TrainingIndizes).Average(); 219 283 220 foreach (var row in ProblemData.TrainingIndizes) { 284 221 if (row + horizon < ProblemData.Dataset.Rows) { 285 allPrognosedTrainingValues.MoveNext(); 286 var prognosedTrainingValues = allPrognosedTrainingValues.Current.SelectMany(x => x.ToArray()).ToArray(); 287 for (int t = 0; t < targetVariables.Length; t++) { 288 var actualContinuation = ProblemData.Dataset.GetDoubleValues(targetVariables[t], 289 Enumerable.Range(row, horizon)); 290 int maWindow = 10 * horizon; 291 var movingAverageContinuation = from h in Enumerable.Range(0, horizon) 292 select (from r in Enumerable.Range(row + h - maWindow, maWindow - h) 293 where r > 0 294 select ProblemData.Dataset.GetDoubleValue(targetVariables[t], r) 295 ).Average(); 296 double startValue = ProblemData.Dataset.GetDoubleValue(targetVariables[t], row - 1); 297 var prognosedContinuation = prognosedTrainingValues.Skip(t).TakeEvery(targetVariables.Length); 298 trainingDsCalculators[t].Add(startValue, actualContinuation, prognosedContinuation); 299 trainingWdsCalculators[t].Add(startValue, actualContinuation, prognosedContinuation); 300 trainingTheilsULastCalculators[t].Add(startValue, actualContinuation, prognosedContinuation); 301 trainingTheilsUMeanCalculators[t].Add(startValue, actualContinuation.Select(x => mean[t]), actualContinuation, prognosedContinuation); 302 trainingTheilsUMovingAverageCalculators[t].Add(startValue, movingAverageContinuation, actualContinuation, prognosedContinuation); 303 304 var actualContinuationEnumerator = actualContinuation.GetEnumerator(); 305 var prognosedContinuationEnumerator = prognosedContinuation.GetEnumerator(); 306 while (actualContinuationEnumerator.MoveNext() & prognosedContinuationEnumerator.MoveNext()) { 307 trainingMseCalculators[t].Add(actualContinuationEnumerator.Current, prognosedContinuationEnumerator.Current); 308 trainingMaeCalculators[t].Add(actualContinuationEnumerator.Current, prognosedContinuationEnumerator.Current); 309 trainingRelErrorCalculators[t].Add(actualContinuationEnumerator.Current, prognosedContinuationEnumerator.Current); 310 trainingRSquaredCalculators[t].Add(actualContinuationEnumerator.Current, prognosedContinuationEnumerator.Current); 311 trainingNmseCalculators[t].Add(actualContinuationEnumerator.Current, prognosedContinuationEnumerator.Current); 312 } 313 if (actualContinuationEnumerator.MoveNext() | prognosedContinuationEnumerator.MoveNext()) 314 throw new ArgumentException( 315 "Different number of elements in Actual continuation and prognosed continuation."); 222 var actualContinuation = ProblemData.Dataset.GetDoubleValues(targetVariable, Enumerable.Range(row, horizon)).ToList(); 223 var prognosedContinuation = GetPrognosedValues(new List<int> { row }, horizon).First().ToList(); 224 225 int maWindow = 10 * horizon; 226 var movingAverageContinuation = from h in Enumerable.Range(0, horizon) 227 select (from r in Enumerable.Range(row + h - maWindow, maWindow - h) 228 where r > 0 229 select ProblemData.Dataset.GetDoubleValue(targetVariable, r) 230 ).Average(); 231 232 double startValue = ProblemData.Dataset.GetDoubleValue(targetVariable, row - 1); 233 234 trainingDsCalculators.Add(startValue, actualContinuation, prognosedContinuation); 235 trainingWdsCalculators.Add(startValue, actualContinuation, prognosedContinuation); 236 trainingTheilsULastCalculators.Add(startValue, actualContinuation, prognosedContinuation); 237 trainingTheilsUMeanCalculators.Add(startValue, actualContinuation.Select(x => mean), actualContinuation, prognosedContinuation); 238 trainingTheilsUMovingAverageCalculators.Add(startValue, movingAverageContinuation, actualContinuation, prognosedContinuation); 239 240 var actualContinuationEnumerator = actualContinuation.GetEnumerator(); 241 var prognosedContinuationEnumerator = prognosedContinuation.GetEnumerator(); 242 243 while (actualContinuationEnumerator.MoveNext() & prognosedContinuationEnumerator.MoveNext()) { 244 trainingMseCalculators.Add(actualContinuationEnumerator.Current, prognosedContinuationEnumerator.Current); 245 trainingMaeCalculators.Add(actualContinuationEnumerator.Current, prognosedContinuationEnumerator.Current); 246 trainingRelErrorCalculators.Add(actualContinuationEnumerator.Current, prognosedContinuationEnumerator.Current); 247 trainingRSquaredCalculators.Add(actualContinuationEnumerator.Current, prognosedContinuationEnumerator.Current); 248 trainingNmseCalculators.Add(actualContinuationEnumerator.Current, prognosedContinuationEnumerator.Current); 316 249 } 250 if (actualContinuationEnumerator.MoveNext() | prognosedContinuationEnumerator.MoveNext()) 251 throw new ArgumentException("Different number of elements in Actual continuation and prognosed continuation."); 317 252 } 318 253 } 319 var allPrognosedTestValues = GetPrognosedValues(ProblemData.TestIndizes, horizon).ToArray().AsEnumerable().GetEnumerator(); 254 255 mean = ProblemData.Dataset.GetDoubleValues(targetVariable, ProblemData.TestIndizes).Average(); 320 256 foreach (var row in ProblemData.TestIndizes) { 321 257 if (row + horizon < ProblemData.Dataset.Rows) { 322 allPrognosedTestValues.MoveNext(); 323 var prognosedTestValues = allPrognosedTestValues.Current.SelectMany(x => x); 324 for (int t = 0; t < targetVariables.Length; t++) { 325 var actualContinuation = ProblemData.Dataset.GetDoubleValues(targetVariables[t], 326 Enumerable.Range(row, horizon)); 327 int maWindow = 10 * horizon; 328 var movingAverageContinuation = from h in Enumerable.Range(0, horizon) 329 select (from r in Enumerable.Range(row + h - maWindow, maWindow - h) 330 where r > 0 331 select ProblemData.Dataset.GetDoubleValue(targetVariables[t], r) 332 ).Average(); 333 double startValue = ProblemData.Dataset.GetDoubleValue(targetVariables[t], row - 1); 334 var prognosedContinuation = prognosedTestValues.Skip(t).TakeEvery(targetVariables.Length).ToArray(); 335 testDsCalculators[t].Add(startValue, actualContinuation, prognosedContinuation); 336 testWdsCalculators[t].Add(startValue, actualContinuation, prognosedContinuation); 337 testTheilsULastCalculators[t].Add(startValue, actualContinuation, prognosedContinuation); 338 testTheilsUMeanCalculators[t].Add(startValue, actualContinuation.Select(x => mean[t]), actualContinuation, prognosedContinuation); 339 testTheilsUMovingAverageCalculators[t].Add(startValue, movingAverageContinuation, actualContinuation, prognosedContinuation); 340 341 var actualContinuationEnumerator = actualContinuation.GetEnumerator(); 342 var prognosedContinuationEnumerator = prognosedContinuation.AsEnumerable().GetEnumerator(); 343 while (actualContinuationEnumerator.MoveNext() & prognosedContinuationEnumerator.MoveNext()) { 344 testMseCalculators[t].Add(actualContinuationEnumerator.Current, prognosedContinuationEnumerator.Current); 345 testMaeCalculators[t].Add(actualContinuationEnumerator.Current, prognosedContinuationEnumerator.Current); 346 testRelErrorCalculators[t].Add(actualContinuationEnumerator.Current, prognosedContinuationEnumerator.Current); 347 testRSquaredCalculators[t].Add(actualContinuationEnumerator.Current, prognosedContinuationEnumerator.Current); 348 testNmseCalculators[t].Add(actualContinuationEnumerator.Current, prognosedContinuationEnumerator.Current); 349 } 350 if (actualContinuationEnumerator.MoveNext() | prognosedContinuationEnumerator.MoveNext()) 351 throw new ArgumentException( 352 "Different number of elements in Actual continuation and prognosed continuation."); 258 var actualContinuation = ProblemData.Dataset.GetDoubleValues(targetVariable, Enumerable.Range(row, horizon)).ToList(); 259 var prognosedContinuation = GetPrognosedValues(new List<int> { row }, horizon).First().ToList(); 260 261 int maWindow = 10 * horizon; 262 var movingAverageContinuation = from h in Enumerable.Range(0, horizon) 263 select (from r in Enumerable.Range(row + h - maWindow, maWindow - h) 264 where r > 0 265 select ProblemData.Dataset.GetDoubleValue(targetVariable, r) 266 ).Average(); 267 268 double startValue = ProblemData.Dataset.GetDoubleValue(targetVariable, row - 1); 269 testDsCalculators.Add(startValue, actualContinuation, prognosedContinuation); 270 testWdsCalculators.Add(startValue, actualContinuation, prognosedContinuation); 271 testTheilsULastCalculators.Add(startValue, actualContinuation, prognosedContinuation); 272 testTheilsUMeanCalculators.Add(startValue, actualContinuation.Select(x => mean), actualContinuation, prognosedContinuation); 273 testTheilsUMovingAverageCalculators.Add(startValue, movingAverageContinuation, actualContinuation, prognosedContinuation); 274 275 var actualContinuationEnumerator = actualContinuation.GetEnumerator(); 276 var prognosedContinuationEnumerator = prognosedContinuation.GetEnumerator(); 277 while (actualContinuationEnumerator.MoveNext() & prognosedContinuationEnumerator.MoveNext()) { 278 testMseCalculators.Add(actualContinuationEnumerator.Current, prognosedContinuationEnumerator.Current); 279 testMaeCalculators.Add(actualContinuationEnumerator.Current, prognosedContinuationEnumerator.Current); 280 testRelErrorCalculators.Add(actualContinuationEnumerator.Current, prognosedContinuationEnumerator.Current); 281 testRSquaredCalculators.Add(actualContinuationEnumerator.Current, prognosedContinuationEnumerator.Current); 282 testNmseCalculators.Add(actualContinuationEnumerator.Current, prognosedContinuationEnumerator.Current); 353 283 } 284 if (actualContinuationEnumerator.MoveNext() | prognosedContinuationEnumerator.MoveNext()) 285 throw new ArgumentException("Different number of elements in Actual continuation and prognosed continuation."); 354 286 } 355 287 } 356 288 357 358 TrainingMeanSquaredError = trainingMseCalculators.Select(c => c.ErrorState == OnlineCalculatorError.None ? c.Value : double.PositiveInfinity) 359 .ToArray(); 360 TestMeanSquaredError = testMseCalculators.Select(c => c.ErrorState == OnlineCalculatorError.None ? c.Value : double.PositiveInfinity) 361 .ToArray(); 362 TrainingMeanAbsoluteError = trainingMaeCalculators.Select(c => c.ErrorState == OnlineCalculatorError.None ? c.Value : double.PositiveInfinity) 363 .ToArray(); 364 TestMeanAbsoluteError = testMaeCalculators.Select(c => c.ErrorState == OnlineCalculatorError.None ? c.Value : double.PositiveInfinity) 365 .ToArray(); 366 TrainingRelativeError = trainingRelErrorCalculators.Select(c => c.ErrorState == OnlineCalculatorError.None ? c.Value : double.PositiveInfinity) 367 .ToArray(); 368 TestRelativeError = testRelErrorCalculators.Select(c => c.ErrorState == OnlineCalculatorError.None ? c.Value : double.PositiveInfinity) 369 .ToArray(); 370 TrainingRSquared = trainingRSquaredCalculators.Select(c => c.ErrorState == OnlineCalculatorError.None ? c.Value : 0.0) 371 .ToArray(); 372 TestRSquared = testRSquaredCalculators.Select(c => c.ErrorState == OnlineCalculatorError.None ? c.Value : 0.0) 373 .ToArray(); 374 TrainingNormalizedMeanSquaredError = trainingNmseCalculators.Select(c => c.ErrorState == OnlineCalculatorError.None ? c.Value : double.PositiveInfinity) 375 .ToArray(); 376 TestNormalizedMeanSquaredError = testNmseCalculators.Select(c => c.ErrorState == OnlineCalculatorError.None ? c.Value : double.PositiveInfinity) 377 .ToArray(); 378 379 TrainingDirectionalSymmetry = trainingDsCalculators.Select(c => c.ErrorState == OnlineCalculatorError.None ? c.Value : 0.0) 380 .ToArray(); 381 TestDirectionalSymmetry = testDsCalculators.Select(c => c.ErrorState == OnlineCalculatorError.None ? c.Value : 0.0) 382 .ToArray(); 383 TrainingWeightedDirectionalSymmetry = trainingWdsCalculators.Select(c => c.ErrorState == OnlineCalculatorError.None ? c.Value : double.PositiveInfinity) 384 .ToArray(); 385 TestWeightedDirectionalSymmetry = testWdsCalculators.Select(c => c.ErrorState == OnlineCalculatorError.None ? c.Value : double.PositiveInfinity) 386 .ToArray(); 387 TrainingTheilsUStatisticLast = trainingTheilsULastCalculators 388 .Select(c => c.ErrorState == OnlineCalculatorError.None ? c.Value : double.PositiveInfinity) 389 .ToArray(); 390 TestTheilsUStatisticLast = testTheilsULastCalculators 391 .Select(c => c.ErrorState == OnlineCalculatorError.None ? c.Value : double.PositiveInfinity) 392 .ToArray(); 393 TrainingTheilsUStatisticMean = trainingTheilsUMeanCalculators 394 .Select(c => c.ErrorState == OnlineCalculatorError.None ? c.Value : double.PositiveInfinity) 395 .ToArray(); 396 TestTheilsUStatisticMean = testTheilsUMeanCalculators 397 .Select(c => c.ErrorState == OnlineCalculatorError.None ? c.Value : double.PositiveInfinity) 398 .ToArray(); 399 TrainingTheilsUStatisticMovingAverage = trainingTheilsUMovingAverageCalculators 400 .Select(c => c.ErrorState == OnlineCalculatorError.None ? c.Value : double.PositiveInfinity) 401 .ToArray(); 402 TestTheilsUStatisticMovingAverage = testTheilsUMovingAverageCalculators 403 .Select(c => c.ErrorState == OnlineCalculatorError.None ? c.Value : double.PositiveInfinity) 404 .ToArray(); 289 TrainingMeanSquaredError = trainingMseCalculators.ErrorState == OnlineCalculatorError.None ? trainingMseCalculators.Value : double.PositiveInfinity; 290 TestMeanSquaredError = testMseCalculators.ErrorState == OnlineCalculatorError.None ? testMseCalculators.Value : double.PositiveInfinity; 291 TrainingMeanAbsoluteError = trainingMaeCalculators.ErrorState == OnlineCalculatorError.None ? trainingMaeCalculators.Value : double.PositiveInfinity; 292 TestMeanAbsoluteError = testMaeCalculators.ErrorState == OnlineCalculatorError.None ? testMaeCalculators.Value : double.PositiveInfinity; 293 TrainingRelativeError = trainingRelErrorCalculators.ErrorState == OnlineCalculatorError.None ? trainingRelErrorCalculators.Value : double.PositiveInfinity; 294 TestRelativeError = testRelErrorCalculators.ErrorState == OnlineCalculatorError.None ? testRelErrorCalculators.Value : double.PositiveInfinity; 295 TrainingRSquared = trainingRSquaredCalculators.ErrorState == OnlineCalculatorError.None ? trainingRSquaredCalculators.Value : 0.0; 296 TestRSquared = testRSquaredCalculators.ErrorState == OnlineCalculatorError.None ? testRSquaredCalculators.Value : 0.0; 297 TrainingNormalizedMeanSquaredError = trainingNmseCalculators.ErrorState == OnlineCalculatorError.None ? trainingNmseCalculators.Value : double.PositiveInfinity; 298 TestNormalizedMeanSquaredError = testNmseCalculators.ErrorState == OnlineCalculatorError.None ? testNmseCalculators.Value : double.PositiveInfinity; 299 300 TrainingDirectionalSymmetry = trainingDsCalculators.ErrorState == OnlineCalculatorError.None ? trainingDsCalculators.Value : 0.0; 301 TestDirectionalSymmetry = testDsCalculators.ErrorState == OnlineCalculatorError.None ? testDsCalculators.Value : 0.0; 302 TrainingWeightedDirectionalSymmetry = trainingWdsCalculators.ErrorState == OnlineCalculatorError.None ? trainingWdsCalculators.Value : double.PositiveInfinity; 303 TestWeightedDirectionalSymmetry = testWdsCalculators.ErrorState == OnlineCalculatorError.None ? testWdsCalculators.Value : double.PositiveInfinity; 304 TrainingTheilsUStatisticLast = trainingTheilsULastCalculators.ErrorState == OnlineCalculatorError.None ? trainingTheilsULastCalculators.Value : double.PositiveInfinity; 305 TestTheilsUStatisticLast = testTheilsULastCalculators.ErrorState == OnlineCalculatorError.None ? testTheilsULastCalculators.Value : double.PositiveInfinity; 306 TrainingTheilsUStatisticMean = trainingTheilsUMeanCalculators.ErrorState == OnlineCalculatorError.None ? trainingTheilsUMeanCalculators.Value : double.PositiveInfinity; 307 TestTheilsUStatisticMean = testTheilsUMeanCalculators.ErrorState == OnlineCalculatorError.None ? testTheilsUMeanCalculators.Value : double.PositiveInfinity; 308 TrainingTheilsUStatisticMovingAverage = trainingTheilsUMovingAverageCalculators.ErrorState == OnlineCalculatorError.None ? trainingTheilsUMovingAverageCalculators.Value : double.PositiveInfinity; 309 TestTheilsUStatisticMovingAverage = testTheilsUMovingAverageCalculators.ErrorState == OnlineCalculatorError.None ? testTheilsUMovingAverageCalculators.Value : double.PositiveInfinity; 405 310 } 406 311 } -
branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis/3.4/Interfaces/TimeSeriesPrognosis/ITimeSeriesPrognosisModel.cs
r7100 r7989 23 23 namespace HeuristicLab.Problems.DataAnalysis { 24 24 public interface ITimeSeriesPrognosisModel : IDataAnalysisModel { 25 IEnumerable<IEnumerable< IEnumerable<double>>> GetPrognosedValues(Dataset dataset, IEnumerable<int> rows, int horizon);25 IEnumerable<IEnumerable<double>> GetPrognosedValues(Dataset dataset, IEnumerable<int> rows, int horizon); 26 26 ITimeSeriesPrognosisSolution CreateTimeSeriesPrognosisSolution(ITimeSeriesPrognosisProblemData problemData); 27 27 } -
branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis/3.4/Interfaces/TimeSeriesPrognosis/ITimeSeriesPrognosisProblemData.cs
r7100 r7989 20 20 #endregion 21 21 22 using System.Collections.Generic;23 22 namespace HeuristicLab.Problems.DataAnalysis { 24 23 public interface ITimeSeriesPrognosisProblemData : IDataAnalysisProblemData { 25 IEnumerable<string> TargetVariables{ get; }24 string TargetVariable { get; } 26 25 } 27 26 } -
branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis/3.4/Interfaces/TimeSeriesPrognosis/ITimeSeriesPrognosisSolution.cs
r7160 r7989 27 27 new ITimeSeriesPrognosisProblemData ProblemData { get; set; } 28 28 29 IEnumerable<IEnumerable<double>> PrognosedTrainingValues { get; } 30 IEnumerable<IEnumerable<double>> PrognosedTestValues { get; } 31 IEnumerable<IEnumerable<IEnumerable<double>>> GetPrognosedValues(IEnumerable<int> rows, int horizon); 29 IEnumerable<IEnumerable<double>> GetPrognosedValues(IEnumerable<int> rows, int horizon); 32 30 33 double []TrainingMeanSquaredError { get; }34 double []TestMeanSquaredError { get; }35 double []TrainingMeanAbsoluteError { get; }36 double []TestMeanAbsoluteError { get; }37 double []TrainingRSquared { get; }38 double []TestRSquared { get; }39 double []TrainingRelativeError { get; }40 double []TestRelativeError { get; }41 double []TrainingNormalizedMeanSquaredError { get; }42 double []TestNormalizedMeanSquaredError { get; }43 double []TrainingTheilsUStatisticLast { get; }44 double []TestTheilsUStatisticLast { get; }45 double []TrainingTheilsUStatisticMean { get; }46 double []TestTheilsUStatisticMean { get; }47 double []TrainingDirectionalSymmetry { get; }48 double []TestDirectionalSymmetry { get; }49 double []TrainingWeightedDirectionalSymmetry { get; }50 double []TestWeightedDirectionalSymmetry { get; }31 double TrainingMeanSquaredError { get; } 32 double TestMeanSquaredError { get; } 33 double TrainingMeanAbsoluteError { get; } 34 double TestMeanAbsoluteError { get; } 35 double TrainingRSquared { get; } 36 double TestRSquared { get; } 37 double TrainingRelativeError { get; } 38 double TestRelativeError { get; } 39 double TrainingNormalizedMeanSquaredError { get; } 40 double TestNormalizedMeanSquaredError { get; } 41 double TrainingTheilsUStatisticLast { get; } 42 double TestTheilsUStatisticLast { get; } 43 double TrainingTheilsUStatisticMean { get; } 44 double TestTheilsUStatisticMean { get; } 45 double TrainingDirectionalSymmetry { get; } 46 double TestDirectionalSymmetry { get; } 47 double TrainingWeightedDirectionalSymmetry { get; } 48 double TestWeightedDirectionalSymmetry { get; } 51 49 } 52 50 }
Note: See TracChangeset
for help on using the changeset viewer.