Changeset 8114
- Timestamp:
- 06/26/12 09:15:55 (12 years ago)
- Location:
- branches/HeuristicLab.TimeSeries
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis.Views/3.4/InteractiveSymbolicTimeSeriesPrognosisSolutionSimplifierView.cs
r7989 r8114 51 51 protected override void UpdateModel(ISymbolicExpressionTree tree) { 52 52 var model = new SymbolicTimeSeriesPrognosisModel(tree, Content.Model.Interpreter); 53 SymbolicTimeSeriesPrognosisModel.Scale(model, Content.ProblemData );53 SymbolicTimeSeriesPrognosisModel.Scale(model, Content.ProblemData, Content.ProblemData.TrainingIndizes); 54 54 Content.Model = model; 55 55 } -
branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis/3.4/SingleObjective/SymbolicTimeSeriesPrognosisSingleObjectiveMeanSquaredErrorEvaluator.cs
r8010 r8114 69 69 70 70 double mse; 71 if (applyLinearScaling ) {71 if (applyLinearScaling && horizon == 1) { //perform normal evaluation and afterwards scale the solution and calculate the fitness value 72 72 var mseCalculator = new OnlineMeanSquaredErrorCalculator(); 73 73 CalculateWithScaling(targetValues, boundedEstimatedValues, mseCalculator, problemData.Dataset.Rows * horizon); 74 74 errorState = mseCalculator.ErrorState; 75 75 mse = mseCalculator.MeanSquaredError; 76 } else if (applyLinearScaling) { //first create model to perform linear scaling and afterwards calculate fitness for the scaled model 77 var model = new SymbolicTimeSeriesPrognosisModel((ISymbolicExpressionTree)solution.Clone(), interpreter, lowerEstimationLimit, upperEstimationLimit); 78 SymbolicTimeSeriesPrognosisModel.Scale(model, problemData, rows); 79 var scaledSolution = model.SymbolicExpressionTree; 80 estimatedValues = interpreter.GetSymbolicExpressionTreeValues(scaledSolution, problemData.Dataset, rows, horizions).SelectMany(x => x); 81 boundedEstimatedValues = estimatedValues.LimitToRange(lowerEstimationLimit, upperEstimationLimit); 82 mse = OnlineMeanSquaredErrorCalculator.Calculate(targetValues, boundedEstimatedValues, out errorState); 76 83 } else 77 84 mse = OnlineMeanSquaredErrorCalculator.Calculate(targetValues, boundedEstimatedValues, out errorState); -
branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis/3.4/SingleObjective/SymbolicTimeSeriesPrognosisSingleObjectiveTrainingBestSolutionAnalyzer.cs
r7989 r8114 77 77 var model = new SymbolicTimeSeriesPrognosisModel((ISymbolicExpressionTree)bestTree.Clone(), SymbolicDataAnalysisTreeInterpreterParameter.ActualValue as ISymbolicTimeSeriesPrognosisExpressionTreeInterpreter, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper); 78 78 if (ApplyLinearScaling.Value) 79 SymbolicTimeSeriesPrognosisModel.Scale(model, ProblemDataParameter.ActualValue );79 SymbolicTimeSeriesPrognosisModel.Scale(model, ProblemDataParameter.ActualValue, ProblemDataParameter.ActualValue.TrainingIndizes); 80 80 return new SymbolicTimeSeriesPrognosisSolution(model, (ITimeSeriesPrognosisProblemData)ProblemDataParameter.ActualValue.Clone()); 81 81 } -
branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis/3.4/SingleObjective/SymbolicTimeSeriesPrognosisSingleObjectiveValidationBestSolutionAnalyzer.cs
r7989 r8114 66 66 var model = new SymbolicTimeSeriesPrognosisModel((ISymbolicExpressionTree)bestTree.Clone(), SymbolicDataAnalysisTreeInterpreterParameter.ActualValue as ISymbolicTimeSeriesPrognosisExpressionTreeInterpreter, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper); 67 67 if (ApplyLinearScaling.Value) 68 SymbolicTimeSeriesPrognosisModel.Scale(model, ProblemDataParameter.ActualValue );68 SymbolicTimeSeriesPrognosisModel.Scale(model, ProblemDataParameter.ActualValue, ProblemDataParameter.ActualValue.TrainingIndizes); 69 69 return new SymbolicTimeSeriesPrognosisSolution(model, (ITimeSeriesPrognosisProblemData)ProblemDataParameter.ActualValue.Clone()); 70 70 } -
branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis/3.4/SymbolicTimeSeriesPrognosisModel.cs
r8010 r8114 98 98 } 99 99 100 public static void Scale(SymbolicTimeSeriesPrognosisModel model, ITimeSeriesPrognosisProblemData problemData ) {100 public static void Scale(SymbolicTimeSeriesPrognosisModel model, ITimeSeriesPrognosisProblemData problemData, IEnumerable<int> rows) { 101 101 var dataset = problemData.Dataset; 102 102 var targetVariable = problemData.TargetVariable; 103 var rows = problemData.TrainingIndizes;104 var estimatedValuesEnumerator = model.Interpreter.GetSymbolicExpressionTreeValues(model.SymbolicExpressionTree, dataset, rows);105 var targetValues Enumerator= problemData.Dataset.GetDoubleValues(targetVariable, rows);103 var estimatedValues = model.Interpreter.GetSymbolicExpressionTreeValues(model.SymbolicExpressionTree, dataset, rows); 104 var boundedEstimatedValues = estimatedValues.LimitToRange(model.lowerEstimationLimit, model.upperEstimationLimit); 105 var targetValues = problemData.Dataset.GetDoubleValues(targetVariable, rows); 106 106 107 107 double alpha, beta; 108 108 OnlineCalculatorError error; 109 OnlineLinearScalingParameterCalculator.Calculate( estimatedValuesEnumerator, targetValuesEnumerator, out alpha, out beta, out error);109 OnlineLinearScalingParameterCalculator.Calculate(boundedEstimatedValues, targetValues, out alpha, out beta, out error); 110 110 if (error != OnlineCalculatorError.None) return; 111 111 -
branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Grammars/TypeCoherentExpressionGrammar.cs
r7842 r8114 227 227 228 228 public void ConfigureAsDefaultTimeSeriesPrognosisGrammar() { 229 Symbols.Where(s => s is Variable).First().Enabled = false; 230 Symbols.Where(s => s.Name == TrigonometricFunctionsName).First().Enabled = false; 231 Symbols.Where(s => s.Name == PowerFunctionsName).First().Enabled = false; 232 Symbols.Where(s => s.Name == ConditionalSymbolsName).First().Enabled = false; 229 Symbols.First(s => s is Variable).Enabled = false; 230 Symbols.First(s => s.Name == TrigonometricFunctionsName).Enabled = false; 231 Symbols.First(s => s.Name == PowerFunctionsName).Enabled = false; 232 Symbols.First(s => s.Name == ConditionalSymbolsName).Enabled = false; 233 Symbols.First(s => s.Name == SpecialFunctionsName).Enabled = false; 233 234 } 234 235 }
Note: See TracChangeset
for help on using the changeset viewer.