Changeset 6760 for branches/PersistenceSpeedUp/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression
- Timestamp:
- 09/14/11 13:59:25 (13 years ago)
- Location:
- branches/PersistenceSpeedUp
- Files:
-
- 13 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/PersistenceSpeedUp
- Property svn:ignore
-
old new 12 12 *.psess 13 13 *.vsp 14 *.docstates
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
branches/PersistenceSpeedUp/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression-3.4.csproj
r5809 r6760 109 109 <ItemGroup> 110 110 <Compile Include="MultiObjective\SymbolicRegressionMultiObjectiveValidationBestSolutionAnalyzer.cs" /> 111 <Compile Include="SingleObjective\SymbolicRegressionConstantOptimizationEvaluator.cs" /> 111 112 <Compile Include="SingleObjective\SymbolicRegressionSingleObjectiveOverfittingAnalyzer.cs" /> 112 113 <Compile Include="SymbolicRegressionModel.cs" /> -
branches/PersistenceSpeedUp/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/HeuristicLabProblemsDataAnalysisSymbolicRegressionPlugin.cs.frame
r6139 r6760 26 26 27 27 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression { 28 [Plugin("HeuristicLab.Problems.DataAnalysis.Symbolic.Regression","Provides classes to perform symbolic regression (single- or multiobjective).", "3.4. 0.$WCREV$")]28 [Plugin("HeuristicLab.Problems.DataAnalysis.Symbolic.Regression","Provides classes to perform symbolic regression (single- or multiobjective).", "3.4.1.$WCREV$")] 29 29 [PluginFile("HeuristicLab.Problems.DataAnalysis.Symbolic.Regression-3.4.dll", PluginFileType.Assembly)] 30 30 [PluginDependency("HeuristicLab.ALGLIB", "3.1")] -
branches/PersistenceSpeedUp/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectiveMeanSquaredErrorTreeSizeEvaluator.cs
r5942 r6760 54 54 public static double[] Calculate(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, ISymbolicExpressionTree solution, double lowerEstimationLimit, double upperEstimationLimit, IRegressionProblemData problemData, IEnumerable<int> rows) { 55 55 IEnumerable<double> estimatedValues = interpreter.GetSymbolicExpressionTreeValues(solution, problemData.Dataset, rows); 56 IEnumerable<double> originalValues = problemData.Dataset.Get EnumeratedVariableValues(problemData.TargetVariable, rows);56 IEnumerable<double> originalValues = problemData.Dataset.GetDoubleValues(problemData.TargetVariable, rows); 57 57 IEnumerable<double> boundedEstimationValues = estimatedValues.LimitToRange(lowerEstimationLimit, upperEstimationLimit); 58 58 OnlineCalculatorError errorState; -
branches/PersistenceSpeedUp/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectivePearsonRSquaredTreeSizeEvaluator.cs
r5942 r6760 54 54 public static double[] Calculate(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, ISymbolicExpressionTree solution, double lowerEstimationLimit, double upperEstimationLimit, IRegressionProblemData problemData, IEnumerable<int> rows) { 55 55 IEnumerable<double> estimatedValues = interpreter.GetSymbolicExpressionTreeValues(solution, problemData.Dataset, rows); 56 IEnumerable<double> originalValues = problemData.Dataset.Get EnumeratedVariableValues(problemData.TargetVariable, rows);56 IEnumerable<double> originalValues = problemData.Dataset.GetDoubleValues(problemData.TargetVariable, rows); 57 57 OnlineCalculatorError errorState; 58 58 double r2 = OnlinePearsonsRSquaredCalculator.Calculate(estimatedValues, originalValues, out errorState); -
branches/PersistenceSpeedUp/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectiveProblem.cs
r5854 r6760 77 77 78 78 private void UpdateEstimationLimits() { 79 if (ProblemData.Training Partition.Start < ProblemData.TrainingPartition.End) {80 var targetValues = ProblemData.Dataset.Get VariableValues(ProblemData.TargetVariable, ProblemData.TrainingPartition.Start, ProblemData.TrainingPartition.End);79 if (ProblemData.TrainingIndizes.Any()) { 80 var targetValues = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TrainingIndizes).ToList(); 81 81 var mean = targetValues.Average(); 82 82 var range = targetValues.Max() - targetValues.Min(); 83 83 EstimationLimits.Upper = mean + PunishmentFactor * range; 84 84 EstimationLimits.Lower = mean - PunishmentFactor * range; 85 } else { 86 EstimationLimits.Upper = double.MaxValue; 87 EstimationLimits.Lower = double.MinValue; 85 88 } 86 89 } -
branches/PersistenceSpeedUp/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/Properties/AssemblyInfo.frame
r6139 r6760 53 53 // by using the '*' as shown below: 54 54 [assembly: AssemblyVersion("3.4.0.0")] 55 [assembly: AssemblyFileVersion("3.4. 0.$WCREV$")]55 [assembly: AssemblyFileVersion("3.4.1.$WCREV$")] -
branches/PersistenceSpeedUp/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionSingleObjectiveMeanSquaredErrorEvaluator.cs
r5942 r6760 56 56 public static double Calculate(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, ISymbolicExpressionTree solution, double lowerEstimationLimit, double upperEstimationLimit, IRegressionProblemData problemData, IEnumerable<int> rows) { 57 57 IEnumerable<double> estimatedValues = interpreter.GetSymbolicExpressionTreeValues(solution, problemData.Dataset, rows); 58 IEnumerable<double> originalValues = problemData.Dataset.Get EnumeratedVariableValues(problemData.TargetVariable, rows);58 IEnumerable<double> originalValues = problemData.Dataset.GetDoubleValues(problemData.TargetVariable, rows); 59 59 IEnumerable<double> boundedEstimationValues = estimatedValues.LimitToRange(lowerEstimationLimit, upperEstimationLimit); 60 60 OnlineCalculatorError errorState; -
branches/PersistenceSpeedUp/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionSingleObjectiveOverfittingAnalyzer.cs
r5907 r6760 79 79 80 80 double[] trainingQuality = QualityParameter.ActualValue.Select(x => x.Value).ToArray(); 81 var problemData = ProblemDataParameter.ActualValue; 82 var evaluator = EvaluatorParameter.ActualValue; 81 83 // evaluate on validation partition 82 IExecutionContext childContext = (IExecutionContext)ExecutionContext.CreateChildOperation(EvaluatorParameter.ActualValue); 83 double[] validationQuality = (from tree in SymbolicExpressionTree 84 select EvaluatorParameter.ActualValue.Evaluate(childContext, tree, ProblemDataParameter.ActualValue, rows)) 85 .ToArray(); 84 IExecutionContext childContext = (IExecutionContext)ExecutionContext.CreateChildOperation(evaluator); 85 double[] validationQuality = SymbolicExpressionTree 86 .AsParallel() 87 .Select(t => evaluator.Evaluate(childContext, t, problemData, rows)) 88 .ToArray(); 86 89 double r = 0.0; 87 90 try { -
branches/PersistenceSpeedUp/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator.cs
r5942 r6760 56 56 public static double Calculate(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, ISymbolicExpressionTree solution, double lowerEstimationLimit, double upperEstimationLimit, IRegressionProblemData problemData, IEnumerable<int> rows) { 57 57 IEnumerable<double> estimatedValues = interpreter.GetSymbolicExpressionTreeValues(solution, problemData.Dataset, rows); 58 IEnumerable<double> originalValues = problemData.Dataset.Get EnumeratedVariableValues(problemData.TargetVariable, rows);58 IEnumerable<double> originalValues = problemData.Dataset.GetDoubleValues(problemData.TargetVariable, rows); 59 59 OnlineCalculatorError errorState; 60 60 double r2 = OnlinePearsonsRSquaredCalculator.Calculate(estimatedValues, originalValues, out errorState); -
branches/PersistenceSpeedUp/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionSingleObjectiveProblem.cs
r5854 r6760 74 74 75 75 private void UpdateEstimationLimits() { 76 if (ProblemData.Training Partition.Start < ProblemData.TrainingPartition.End) {77 var targetValues = ProblemData.Dataset.Get VariableValues(ProblemData.TargetVariable, ProblemData.TrainingPartition.Start, ProblemData.TrainingPartition.End);76 if (ProblemData.TrainingIndizes.Any()) { 77 var targetValues = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TrainingIndizes).ToList(); 78 78 var mean = targetValues.Average(); 79 79 var range = targetValues.Max() - targetValues.Min(); 80 80 EstimationLimits.Upper = mean + PunishmentFactor * range; 81 81 EstimationLimits.Lower = mean - PunishmentFactor * range; 82 } else { 83 EstimationLimits.Upper = double.MaxValue; 84 EstimationLimits.Lower = double.MinValue; 82 85 } 83 86 } -
branches/PersistenceSpeedUp/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionModel.cs
r5942 r6760 31 31 /// </summary> 32 32 [StorableClass] 33 [Item(Name = "Symbolic RegressionModel", Description = "Represents a symbolic regression model.")]33 [Item(Name = "Symbolic Regression Model", Description = "Represents a symbolic regression model.")] 34 34 public class SymbolicRegressionModel : SymbolicDataAnalysisModel, ISymbolicRegressionModel { 35 35 [Storable] … … 61 61 } 62 62 63 public ISymbolicRegressionSolution CreateRegressionSolution(IRegressionProblemData problemData) { 64 return new SymbolicRegressionSolution(this, problemData); 65 } 66 IRegressionSolution IRegressionModel.CreateRegressionSolution(IRegressionProblemData problemData) { 67 return CreateRegressionSolution(problemData); 68 } 69 63 70 public static void Scale(SymbolicRegressionModel model, IRegressionProblemData problemData) { 64 71 var dataset = problemData.Dataset; … … 66 73 var rows = problemData.TrainingIndizes; 67 74 var estimatedValues = model.Interpreter.GetSymbolicExpressionTreeValues(model.SymbolicExpressionTree, dataset, rows); 68 var targetValues = dataset.Get EnumeratedVariableValues(targetVariable, rows);75 var targetValues = dataset.GetDoubleValues(targetVariable, rows); 69 76 double alpha; 70 77 double beta; … … 95 102 var mainBranch = startNode.GetSubtree(0); 96 103 startNode.RemoveSubtree(0); 97 var scaledMainBranch = MakeSum(MakeProduct( beta, mainBranch), alpha);104 var scaledMainBranch = MakeSum(MakeProduct(mainBranch, beta), alpha); 98 105 startNode.AddSubtree(scaledMainBranch); 99 106 } … … 104 111 return treeNode; 105 112 } else { 106 var node = (new Addition()).CreateTreeNode(); 113 var addition = new Addition(); 114 var node = addition.CreateTreeNode(); 107 115 var alphaConst = MakeConstant(alpha); 108 116 node.AddSubtree(treeNode); … … 112 120 } 113 121 114 private static ISymbolicExpressionTreeNode MakeProduct( double beta, ISymbolicExpressionTreeNode treeNode) {122 private static ISymbolicExpressionTreeNode MakeProduct(ISymbolicExpressionTreeNode treeNode, double beta) { 115 123 if (beta.IsAlmost(1.0)) { 116 124 return treeNode; 117 125 } else { 118 var node = (new Multiplication()).CreateTreeNode(); 126 var multipliciation = new Multiplication(); 127 var node = multipliciation.CreateTreeNode(); 119 128 var betaConst = MakeConstant(beta); 120 129 node.AddSubtree(treeNode); -
branches/PersistenceSpeedUp/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionSolution.cs
r5975 r6760 20 20 #endregion 21 21 22 using System;23 22 using HeuristicLab.Common; 24 23 using HeuristicLab.Core; … … 70 69 } 71 70 72 protected override void OnModelChanged(EventArgs e) { 73 base.OnModelChanged(e); 74 RecalculateResults(); 75 } 76 77 private new void RecalculateResults() { 71 protected override void RecalculateResults() { 72 base.RecalculateResults(); 78 73 ModelLength = Model.SymbolicExpressionTree.Length; 79 74 ModelDepth = Model.SymbolicExpressionTree.Depth;
Note: See TracChangeset
for help on using the changeset viewer.