Changeset 6760 for branches/PersistenceSpeedUp/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification
- Timestamp:
- 09/14/11 13:59:25 (13 years ago)
- Location:
- branches/PersistenceSpeedUp
- Files:
-
- 15 edited
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.Classification/3.4/HeuristicLabProblemsDataAnalysisSymbolicClassificationPlugin.cs.frame
r6139 r6760 26 26 27 27 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification { 28 [Plugin("HeuristicLab.Problems.DataAnalysis.Symbolic.Classification","Provides classes to perform symbolic classification (single- or multiobjective).", "3.4. 0.$WCREV$")]28 [Plugin("HeuristicLab.Problems.DataAnalysis.Symbolic.Classification","Provides classes to perform symbolic classification (single- or multiobjective).", "3.4.1.$WCREV$")] 29 29 [PluginFile("HeuristicLab.Problems.DataAnalysis.Symbolic.Classification-3.4.dll", PluginFileType.Assembly)] 30 30 [PluginDependency("HeuristicLab.ALGLIB", "3.1")] -
branches/PersistenceSpeedUp/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectiveMeanSquaredErrorTreeSizeEvaluator.cs
r5942 r6760 54 54 public static double[] Calculate(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, ISymbolicExpressionTree solution, double lowerEstimationLimit, double upperEstimationLimit, IClassificationProblemData 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.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectivePearsonRSquaredTreeSizeEvaluator.cs
r5942 r6760 33 33 public static double[] Calculate(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, ISymbolicExpressionTree solution, double lowerEstimationLimit, double upperEstimationLimit, IClassificationProblemData problemData, IEnumerable<int> rows) { 34 34 IEnumerable<double> estimatedValues = interpreter.GetSymbolicExpressionTreeValues(solution, problemData.Dataset, rows); 35 IEnumerable<double> originalValues = problemData.Dataset.Get EnumeratedVariableValues(problemData.TargetVariable, rows);35 IEnumerable<double> originalValues = problemData.Dataset.GetDoubleValues(problemData.TargetVariable, rows); 36 36 OnlineCalculatorError errorState; 37 37 double r2 = OnlinePearsonsRSquaredCalculator.Calculate(estimatedValues, originalValues, out errorState); -
branches/PersistenceSpeedUp/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectiveProblem.cs
r5854 r6760 73 73 74 74 private void UpdateEstimationLimits() { 75 if (ProblemData.Training Partition.Start < ProblemData.TrainingPartition.End) {76 var targetValues = ProblemData.Dataset.Get VariableValues(ProblemData.TargetVariable, ProblemData.TrainingPartition.Start, ProblemData.TrainingPartition.End);75 if (ProblemData.TrainingIndizes.Any()) { 76 var targetValues = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TrainingIndizes).ToList(); 77 77 var mean = targetValues.Average(); 78 78 var range = targetValues.Max() - targetValues.Min(); 79 79 EstimationLimits.Upper = mean + PunishmentFactor * range; 80 80 EstimationLimits.Lower = mean - PunishmentFactor * range; 81 } else { 82 EstimationLimits.Upper = double.MaxValue; 83 EstimationLimits.Lower = double.MinValue; 81 84 } 82 85 } -
branches/PersistenceSpeedUp/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/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.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveBoundedMeanSquaredErrorEvaluator.cs
r5906 r6760 54 54 public static double Calculate(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, ISymbolicExpressionTree solution, double lowerEstimationLimit, double upperEstimationLimit, IClassificationProblemData 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 -
branches/PersistenceSpeedUp/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveMeanSquaredErrorEvaluator.cs
r5942 r6760 54 54 public static double Calculate(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, ISymbolicExpressionTree solution, double lowerEstimationLimit, double upperEstimationLimit, IClassificationProblemData 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.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveOverfittingAnalyzer.cs
r5907 r6760 76 76 public override IOperation Apply() { 77 77 double[] trainingQuality = QualityParameter.ActualValue.Select(x => x.Value).ToArray(); 78 var problemData = ProblemDataParameter.ActualValue; 79 var evaluator = EvaluatorParameter.ActualValue; 78 80 // evaluate on validation partition 79 81 IEnumerable<int> rows = GenerateRowsToEvaluate(); 80 82 if (!rows.Any()) return base.Apply(); 81 82 IExecutionContext childContext = (IExecutionContext)ExecutionContext.CreateChildOperation(EvaluatorParameter.ActualValue);83 double[] validationQuality = (from tree in SymbolicExpressionTree84 select EvaluatorParameter.ActualValue.Evaluate(childContext, tree, ProblemDataParameter.ActualValue, rows))85 83 IExecutionContext childContext = (IExecutionContext)ExecutionContext.CreateChildOperation(evaluator); 84 double[] validationQuality = SymbolicExpressionTree 85 .AsParallel() 86 .Select(t => evaluator.Evaluate(childContext, t, problemData, rows)) 87 .ToArray(); 86 88 double r = 0.0; 87 89 try { -
branches/PersistenceSpeedUp/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectivePearsonRSquaredEvaluator.cs
r5942 r6760 54 54 public static double Calculate(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, ISymbolicExpressionTree solution, double lowerEstimationLimit, double upperEstimationLimit, IClassificationProblemData 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.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveProblem.cs
r5854 r6760 72 72 73 73 private void UpdateEstimationLimits() { 74 if (ProblemData.Training Partition.Start < ProblemData.TrainingPartition.End) {75 var targetValues = ProblemData.Dataset.Get VariableValues(ProblemData.TargetVariable, ProblemData.TrainingPartition.Start, ProblemData.TrainingPartition.End);74 if (ProblemData.TrainingIndizes.Any()) { 75 var targetValues = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TrainingIndizes).ToList(); 76 76 var mean = targetValues.Average(); 77 77 var range = targetValues.Max() - targetValues.Min(); 78 78 EstimationLimits.Upper = mean + PunishmentFactor * range; 79 79 EstimationLimits.Lower = mean - PunishmentFactor * range; 80 } else { 81 EstimationLimits.Upper = double.MaxValue; 82 EstimationLimits.Lower = double.MinValue; 80 83 } 81 84 } -
branches/PersistenceSpeedUp/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SymbolicClassificationModel.cs
r5809 r6760 21 21 22 22 using System.Collections.Generic; 23 using System.Linq;24 23 using HeuristicLab.Common; 25 24 using HeuristicLab.Core; 26 using HeuristicLab.Data;27 25 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 28 using HeuristicLab.Operators;29 using HeuristicLab.Parameters;30 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 31 using HeuristicLab.Optimization;32 using System;33 27 34 28 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification { … … 55 49 return Interpreter.GetSymbolicExpressionTreeValues(SymbolicExpressionTree, dataset, rows); 56 50 } 51 52 public ISymbolicClassificationSolution CreateClassificationSolution(IClassificationProblemData problemData) { 53 return new SymbolicClassificationSolution(this, problemData); 54 } 55 IClassificationSolution IClassificationModel.CreateClassificationSolution(IClassificationProblemData problemData) { 56 return CreateClassificationSolution(problemData); 57 } 58 59 57 60 } 58 61 } -
branches/PersistenceSpeedUp/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SymbolicClassificationSolution.cs
r5809 r6760 20 20 #endregion 21 21 22 using System.Collections.Generic;23 using System.Linq;24 22 using HeuristicLab.Common; 25 23 using HeuristicLab.Core; 26 24 using HeuristicLab.Data; 27 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 28 using HeuristicLab.Operators; 29 using HeuristicLab.Parameters; 25 using HeuristicLab.Optimization; 30 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 31 using HeuristicLab.Optimization;32 using System;33 27 34 28 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification { … … 76 70 } 77 71 78 protected override void OnModelChanged(EventArgs e) { 79 base.OnModelChanged(e); 80 RecalculateResults(); 81 } 82 83 private new void RecalculateResults() { 72 protected override void RecalculateResults() { 84 73 ModelLength = Model.SymbolicExpressionTree.Length; 85 74 ModelDepth = Model.SymbolicExpressionTree.Depth; 75 CalculateResults(); 86 76 } 87 77 } -
branches/PersistenceSpeedUp/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SymbolicDiscriminantFunctionClassificationModel.cs
r5942 r6760 20 20 #endregion 21 21 22 using System; 22 23 using System.Collections.Generic; 23 24 using System.Linq; 24 25 using HeuristicLab.Common; 25 26 using HeuristicLab.Core; 26 using HeuristicLab.Data;27 27 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 28 using HeuristicLab.Operators;29 using HeuristicLab.Parameters;30 28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 31 using HeuristicLab.Optimization;32 using System;33 29 34 30 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification { … … 108 104 } 109 105 106 public SymbolicDiscriminantFunctionClassificationSolution CreateClassificationSolution(IClassificationProblemData problemData) { 107 return new SymbolicDiscriminantFunctionClassificationSolution(this, problemData); 108 } 109 IClassificationSolution IClassificationModel.CreateClassificationSolution(IClassificationProblemData problemData) { 110 return CreateClassificationSolution(problemData); 111 } 112 IDiscriminantFunctionClassificationSolution IDiscriminantFunctionClassificationModel.CreateDiscriminantFunctionClassificationSolution(IClassificationProblemData problemData) { 113 return CreateClassificationSolution(problemData); 114 } 115 110 116 #region events 111 117 public event EventHandler ThresholdsChanged; … … 121 127 var rows = problemData.TrainingIndizes; 122 128 var estimatedValues = model.Interpreter.GetSymbolicExpressionTreeValues(model.SymbolicExpressionTree, dataset, rows); 123 var targetValues = dataset.Get EnumeratedVariableValues(targetVariable, rows);129 var targetValues = dataset.GetDoubleValues(targetVariable, rows); 124 130 double alpha; 125 131 double beta; … … 150 156 var mainBranch = startNode.GetSubtree(0); 151 157 startNode.RemoveSubtree(0); 152 var scaledMainBranch = MakeSum(MakeProduct( beta, mainBranch), alpha);158 var scaledMainBranch = MakeSum(MakeProduct(mainBranch, beta), alpha); 153 159 startNode.AddSubtree(scaledMainBranch); 154 160 } … … 159 165 return treeNode; 160 166 } else { 161 var node = (new Addition()).CreateTreeNode(); 167 var addition = new Addition(); 168 var node = addition.CreateTreeNode(); 162 169 var alphaConst = MakeConstant(alpha); 163 170 node.AddSubtree(treeNode); … … 167 174 } 168 175 169 private static ISymbolicExpressionTreeNode MakeProduct( double beta, ISymbolicExpressionTreeNode treeNode) {176 private static ISymbolicExpressionTreeNode MakeProduct(ISymbolicExpressionTreeNode treeNode, double beta) { 170 177 if (beta.IsAlmost(1.0)) { 171 178 return treeNode; 172 179 } else { 173 var node = (new Multiplication()).CreateTreeNode(); 180 var multipliciation = new Multiplication(); 181 var node = multipliciation.CreateTreeNode(); 174 182 var betaConst = MakeConstant(beta); 175 183 node.AddSubtree(treeNode); -
branches/PersistenceSpeedUp/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SymbolicDiscriminantFunctionClassificationSolution.cs
r5975 r6760 20 20 #endregion 21 21 22 using System;23 22 using HeuristicLab.Common; 24 23 using HeuristicLab.Core; … … 74 73 } 75 74 76 protected override void OnModelChanged(EventArgs e) { 77 base.OnModelChanged(e); 78 RecalculateResults(); 79 } 80 81 private new void RecalculateResults() { 75 protected override void RecalculateResults() { 76 CalculateResults(); 77 CalculateRegressionResults(); 82 78 ModelLength = Model.SymbolicExpressionTree.Length; 83 79 ModelDepth = Model.SymbolicExpressionTree.Depth; 84 80 } 81 85 82 } 86 83 }
Note: See TracChangeset
for help on using the changeset viewer.