- Timestamp:
- 08/30/10 10:04:03 (14 years ago)
- Location:
- branches/DataAnalysis
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataAnalysis
-
Property
svn:mergeinfo
set to
/trunk/sources merged eligible
-
Property
svn:mergeinfo
set to
-
branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis.Regression/3.3/HeuristicLab.Problems.DataAnalysis.Regression-3.3.csproj
r4271 r4341 127 127 </Compile> 128 128 <Compile Include="Symbolic\Analyzers\SymbolicRegressionSolutionLinearScaler.cs" /> 129 <Compile Include="Symbolic\Analyzers\SymbolicRegressionTournamentPruning.cs" /> 129 <Compile Include="Symbolic\Analyzers\SymbolicRegressionTournamentPruning.cs"> 130 <SubType>Code</SubType> 131 </Compile> 130 132 <Compile Include="Symbolic\Analyzers\SymbolicRegressionVariableFrequencyAnalyzer.cs" /> 131 133 <Compile Include="Symbolic\Analyzers\ValidationBestScaledSymbolicRegressionSolutionAnalyzer.cs" /> -
branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/SymbolicRegressionProblem.cs
r4128 r4341 21 21 22 22 using System; 23 using System.Collections.Generic;24 23 using System.Linq; 25 24 using HeuristicLab.Common; 26 25 using HeuristicLab.Core; 27 26 using HeuristicLab.Data; 28 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;29 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Analyzers;30 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Creators;31 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Interfaces;32 27 using HeuristicLab.Optimization; 33 28 using HeuristicLab.Parameters; 34 29 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 35 using HeuristicLab.PluginInfrastructure;36 30 using HeuristicLab.Problems.DataAnalysis.Regression.Symbolic.Analyzers; 37 using HeuristicLab.Problems.DataAnalysis.Symbolic;38 31 39 32 namespace HeuristicLab.Problems.DataAnalysis.Regression.Symbolic { … … 84 77 public SymbolicRegressionProblem() 85 78 : base() { 86 var evaluator = new SymbolicRegression ScaledMeanSquaredErrorEvaluator();87 Parameters.Add(new ValueParameter<BoolValue>("Maximization", "Set to false as the error of the regression model should be minimized.", (BoolValue)new BoolValue( false).AsReadOnly()));79 var evaluator = new SymbolicRegressionPearsonsRSquaredEvaluator(); 80 Parameters.Add(new ValueParameter<BoolValue>("Maximization", "Set to false as the error of the regression model should be minimized.", (BoolValue)new BoolValue(true))); 88 81 Parameters.Add(new ValueParameter<ISymbolicRegressionEvaluator>("Evaluator", "The operator which should be used to evaluate symbolic regression solutions.", evaluator)); 89 82 Parameters.Add(new OptionalValueParameter<DoubleValue>("BestKnownQuality", "The minimal error value that reached by symbolic regression solutions for the problem.")); 90 83 91 evaluator.QualityParameter.ActualName = "Training MeanSquaredError";84 evaluator.QualityParameter.ActualName = "TrainingPearsonR2"; 92 85 93 86 InitializeOperators(); -
branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/SymbolicRegressionProblemBase.cs
r4225 r4341 113 113 public ISymbolicExpressionGrammar FunctionTreeGrammar { 114 114 get { return (ISymbolicExpressionGrammar)FunctionTreeGrammarParameter.Value; } 115 private set { FunctionTreeGrammarParameter.Value = value; } 115 116 } 116 117 public override IEnumerable<IOperator> Operators { … … 190 191 MaxFunctionDefiningBranchesParameter.ValueChanged += new EventHandler(ArchitectureParameter_ValueChanged); 191 192 SolutionCreatorParameter.ValueChanged += new EventHandler(SolutionCreatorParameter_ValueChanged); 193 FunctionTreeGrammarParameter.ValueChanged += new EventHandler(FunctionTreeGrammarParameter_ValueChanged); 192 194 } 193 195 … … 211 213 UpdateGrammar(); 212 214 } 213 protected virtual void OnGrammarChanged( EventArgs e) {}215 protected virtual void OnGrammarChanged() { UpdateGrammar(); } 214 216 protected virtual void OnOperatorsChanged(EventArgs e) { RaiseOperatorsChanged(e); } 215 217 protected virtual void OnSolutionCreatorChanged(EventArgs e) { … … 231 233 232 234 #region event handlers 235 private void FunctionTreeGrammarParameter_ValueChanged(object sender, EventArgs e) { 236 if (!(FunctionTreeGrammar is GlobalSymbolicExpressionGrammar)) 237 FunctionTreeGrammar = new GlobalSymbolicExpressionGrammar(FunctionTreeGrammar); 238 OnGrammarChanged(); 239 } 240 233 241 private void SolutionCreatorParameter_ValueChanged(object sender, EventArgs e) { 234 242 OnSolutionCreatorChanged(e); … … 287 295 operators = new List<IOperator>(); 288 296 operators.AddRange(ApplicationManager.Manager.GetInstances<ISymbolicExpressionTreeOperator>().OfType<IOperator>()); 289 operators.Add(new SymbolicRegressionTournamentPruning());290 297 operators.Add(new SymbolicRegressionVariableFrequencyAnalyzer()); 291 298 operators.Add(new MinAverageMaxSymbolicExpressionTreeSizeAnalyzer()); -
branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/SymbolicRegressionSolution.cs
r4068 r4341 26 26 using HeuristicLab.Core; 27 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 28 using HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols; 28 29 29 30 namespace HeuristicLab.Problems.DataAnalysis.Regression.Symbolic { … … 50 51 51 52 protected override void RecalculateEstimatedValues() { 52 estimatedValues = (from x in Model.GetEstimatedValues(ProblemData, 0, ProblemData.Dataset.Rows) 53 let boundedX = Math.Min(UpperEstimationLimit, Math.Max(LowerEstimationLimit, x)) 54 select double.IsNaN(boundedX) ? UpperEstimationLimit : boundedX).ToList(); 53 int minLag = 0; 54 var laggedTreeNodes = Model.SymbolicExpressionTree.IterateNodesPrefix().OfType<LaggedVariableTreeNode>(); 55 if (laggedTreeNodes.Any()) 56 minLag = laggedTreeNodes.Min(node => node.Lag); 57 IEnumerable<double> calculatedValues = 58 from x in Model.GetEstimatedValues(ProblemData, 0 - minLag, ProblemData.Dataset.Rows) 59 let boundedX = Math.Min(UpperEstimationLimit, Math.Max(LowerEstimationLimit, x)) 60 select double.IsNaN(boundedX) ? UpperEstimationLimit : boundedX; 61 estimatedValues = Enumerable.Repeat(double.NaN, Math.Abs(minLag)).Concat(calculatedValues).ToList(); 55 62 OnEstimatedValuesChanged(); 56 63 }
Note: See TracChangeset
for help on using the changeset viewer.