Changeset 5613
- Timestamp:
- 03/06/11 12:55:36 (14 years ago)
- Location:
- branches/DataAnalysis Refactoring
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Interfaces/ISymbolicClassificationSolution.cs
r5557 r5613 21 21 22 22 23 using HeuristicLab.Problems.DataAnalysis.Symbolic .Interfaces;23 using HeuristicLab.Problems.DataAnalysis.Symbolic; 24 24 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification { 25 25 public interface ISymbolicClassificationSolution : ISymbolicDataAnalysisSolution { -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectiveMeanSquaredErrorTreeSizeEvaluator.cs
r5549 r5613 58 58 return new double[2] { mse, solution.Length }; 59 59 } 60 61 public override double[] Evaluate(IExecutionContext context, ISymbolicExpressionTree tree, IClassificationProblemData problemData, IEnumerable<int> rows) { 62 return Calculate(SymbolicDataAnalysisTreeInterpreter, tree, LowerEstimationLimit.Value, UpperEstimationLimit.Value, problemData, rows); 63 } 60 64 } 61 65 } -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectivePearsonRSquaredTreeSizeEvaluator.cs
r5551 r5613 36 36 return new double[2] { r2, solution.Length }; 37 37 } 38 39 public override double[] Evaluate(IExecutionContext context, ISymbolicExpressionTree tree, IClassificationProblemData problemData, IEnumerable<int> rows) { 40 return Calculate(SymbolicDataAnalysisTreeInterpreter, tree, LowerEstimationLimit.Value, UpperEstimationLimit.Value, problemData, rows); 41 } 38 42 } 39 43 } -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveMeanSquaredErrorEvaluator.cs
r5547 r5613 57 57 return OnlineMeanSquaredErrorEvaluator.Calculate(originalValues, boundedEstimationValues); 58 58 } 59 60 public override double Evaluate(IExecutionContext context, ISymbolicExpressionTree tree, IClassificationProblemData problemData, IEnumerable<int> rows) { 61 return Calculate(SymbolicDataAnalysisTreeInterpreter, tree, LowerEstimationLimit.Value, UpperEstimationLimit.Value, problemData, rows); 62 } 59 63 } 60 64 } -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectivePearsonRSquaredEvaluator.cs
r5551 r5613 56 56 return OnlinePearsonsRSquaredEvaluator.Calculate(originalValues, estimatedValues); 57 57 } 58 59 public override double Evaluate(IExecutionContext context, ISymbolicExpressionTree tree, IClassificationProblemData problemData, IEnumerable<int> rows) { 60 return Calculate(SymbolicDataAnalysisTreeInterpreter, tree, LowerEstimationLimit.Value, UpperEstimationLimit.Value, problemData, rows); 61 } 58 62 } 59 63 } -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/Interfaces/ISymbolicRegressionSolution.cs
r5557 r5613 21 21 22 22 23 using HeuristicLab.Problems.DataAnalysis.Symbolic .Interfaces;23 using HeuristicLab.Problems.DataAnalysis.Symbolic; 24 24 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression { 25 25 public interface ISymbolicRegressionSolution : ISymbolicDataAnalysisSolution { -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectiveMeanSquaredErrorTreeSizeEvaluator.cs
r5601 r5613 58 58 return new double[2] { mse, solution.Length }; 59 59 } 60 61 public override double[] Evaluate(IExecutionContext context, ISymbolicExpressionTree tree, IRegressionProblemData problemData, IEnumerable<int> rows) { 62 return Calculate(SymbolicDataAnalysisTreeInterpreter, tree, LowerEstimationLimit.Value, UpperEstimationLimit.Value, problemData, rows); 63 } 60 64 } 61 65 } -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectivePearsonRSquaredTreeSizeEvaluator.cs
r5601 r5613 57 57 return new double[2] { r2, solution.Length }; 58 58 } 59 60 public override double[] Evaluate(IExecutionContext context, ISymbolicExpressionTree tree, IRegressionProblemData problemData, IEnumerable<int> rows) { 61 return Calculate(SymbolicDataAnalysisTreeInterpreter, tree, LowerEstimationLimit.Value, UpperEstimationLimit.Value, problemData, rows); 62 } 59 63 } 60 64 } -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionSingleObjectiveMeanSquaredErrorEvaluator.cs
r5607 r5613 58 58 } 59 59 60 public override double Evaluate(IExecutionContext context, ISymbolicExpressionTree tree, 60 public override double Evaluate(IExecutionContext context, ISymbolicExpressionTree tree, IRegressionProblemData problemData, IEnumerable<int> rows) { 61 61 return Calculate(SymbolicDataAnalysisTreeInterpreter, tree, LowerEstimationLimit.Value, UpperEstimationLimit.Value, problemData, rows); 62 62 } -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator.cs
r5601 r5613 46 46 public override IOperation Apply() { 47 47 IEnumerable<int> rows = GenerateRowsToEvaluate(); 48 double quality = Calculate(SymbolicDataAnalysisTreeInterpreter Parameter.ActualValue, SymbolicExpressionTreeParameter.ActualValue, LowerEstimationLimit.Value, UpperEstimationLimit.Value, ProblemData, rows);49 Quality Parameter.ActualValue= new DoubleValue(quality);48 double quality = Calculate(SymbolicDataAnalysisTreeInterpreter, SymbolicExpressionTree, LowerEstimationLimit.Value, UpperEstimationLimit.Value, ProblemData, rows); 49 Quality = new DoubleValue(quality); 50 50 return base.Apply(); 51 51 } … … 56 56 return OnlinePearsonsRSquaredEvaluator.Calculate(originalValues, estimatedValues); 57 57 } 58 59 public override double Evaluate(IExecutionContext context, ISymbolicExpressionTree tree, IRegressionProblemData problemData, IEnumerable<int> rows) { 60 return Calculate(SymbolicDataAnalysisTreeInterpreter, tree, LowerEstimationLimit.Value, UpperEstimationLimit.Value, problemData, rows); 61 } 58 62 } 59 63 } -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionSingleObjectiveValidationBestSolutionAnalyzer.cs
r5607 r5613 37 37 [Item("SymbolicRegressionSingleObjectiveValidationBestSolutionAnalyzer", "An operator that analyzes the validation best symbolic regression solution for single objective symbolic regression problems.")] 38 38 [StorableClass] 39 public sealed class SymbolicRegressionSingleObjectiveValidationBestSolutionAnalyzer : SymbolicDataAnalysisSingleObjectiveValidationBestSolutionAnalyzer<ISymbolicRegressionSolution, ISymbolicRegression Evaluator, IRegressionProblemData> {39 public sealed class SymbolicRegressionSingleObjectiveValidationBestSolutionAnalyzer : SymbolicDataAnalysisSingleObjectiveValidationBestSolutionAnalyzer<ISymbolicRegressionSolution, ISymbolicRegressionSingleObjectiveEvaluator, IRegressionProblemData> { 40 40 [StorableConstructor] 41 41 private SymbolicRegressionSingleObjectiveValidationBestSolutionAnalyzer(bool deserializing) : base(deserializing) { } -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisSingleObjectiveValidationBestSolutionAnalyzer.cs
r5607 r5613 102 102 IEnumerable<int> rows = Enumerable.Range(start, end - start); 103 103 for (int i = 0; i < tree.Length; i++) { 104 quality[i] = evaluator.Evaluate(ExecutionContext, tree[i], ProblemData .Dataset, rows);104 quality[i] = evaluator.Evaluate(ExecutionContext, tree[i], ProblemData, rows); 105 105 if (IsBetter(quality[i], bestQuality, Maximization.Value)) { 106 106 bestQuality = quality[i]; -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Evaluators/SymbolicDataAnalysisMultiObjectiveEvaluator.cs
r5607 r5613 49 49 } 50 50 51 public abstract double[] Evaluate(IExecutionContext context, ISymbolicExpressionTree tree, Dataset dataset, IEnumerable<int> rows);51 public abstract double[] Evaluate(IExecutionContext context, ISymbolicExpressionTree tree, T problemData, IEnumerable<int> rows); 52 52 } 53 53 } -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Evaluators/SymbolicDataAnalysisSingleObjectiveEvaluator.cs
r5607 r5613 56 56 57 57 58 public abstract double Evaluate(IExecutionContext context, ISymbolicExpressionTree tree, Dataset dataset, IEnumerable<int> rows);58 public abstract double Evaluate(IExecutionContext context, ISymbolicExpressionTree tree, T problemData, IEnumerable<int> rows); 59 59 } 60 60 } -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/ISymbolicDataAnalysisMultiObjectiveEvaluator.cs
r5607 r5613 30 30 where T : class,IDataAnalysisProblemData { 31 31 IEnumerable<bool> Maximization { get; } 32 double[] Evaluate( ExecutionContext context, ISymbolicExpressionTree tree, T problemData, IEnumerable<int> rows);32 double[] Evaluate(IExecutionContext context, ISymbolicExpressionTree tree, T problemData, IEnumerable<int> rows); 33 33 } 34 34 } -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/ISymbolicDataAnalysisSingleObjectiveEvaluator.cs
r5607 r5613 29 29 bool Maximization { get; } 30 30 31 double Evaluate(IExecutionContext context, ISymbolicExpressionTree tree, Dataset dataset, IEnumerable<int> rows);31 double Evaluate(IExecutionContext context, ISymbolicExpressionTree tree, T problemData, IEnumerable<int> rows); 32 32 } 33 33 } -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisSolution.cs
r5607 r5613 70 70 #endregion 71 71 72 public event EventHandler ModelChanged;73 74 public event EventHandler ProblemDataChanged;75 76 72 [StorableConstructor] 77 73 protected SymbolicDataAnalysisSolution(bool deserializing) : base(deserializing) { } 78 74 protected SymbolicDataAnalysisSolution(SymbolicDataAnalysisSolution original, Cloner cloner) 79 75 : base(original, cloner) { 76 name = original.Name; 77 description = original.Description; 80 78 } 81 79 public SymbolicDataAnalysisSolution() 82 80 : base() { 81 name = string.Empty; 82 description = string.Empty; 83 83 Add(new Result(ModelResultName, "The symbolic data analysis model.", typeof(IDataAnalysisModel))); 84 84 Add(new Result(ProblemDataResultName, "The symbolic data analysis problem data.", typeof(IDataAnalysisProblemData))); 85 85 } 86 86 87 public event EventHandler ModelChanged; 87 88 protected virtual void OnModelChanged(EventArgs e) { 88 89 var listeners = ModelChanged; … … 90 91 } 91 92 93 public event EventHandler ProblemDataChanged; 92 94 protected virtual void OnProblemDataChanged(EventArgs e) { 93 95 var listeners = ProblemDataChanged; 94 96 if (listeners != null) listeners(this, e); 95 97 } 98 99 #region INamedItem Members 100 [Storable] 101 protected string name; 102 public string Name { 103 get { return name; } 104 set { 105 if (!CanChangeName) throw new NotSupportedException("Name cannot be changed."); 106 if (!(name.Equals(value) || (value == null) && (name == string.Empty))) { 107 CancelEventArgs<string> e = value == null ? new CancelEventArgs<string>(string.Empty) : new CancelEventArgs<string>(value); 108 OnNameChanging(e); 109 if (!e.Cancel) { 110 name = value == null ? string.Empty : value; 111 OnNameChanged(); 112 } 113 } 114 } 115 } 116 public virtual bool CanChangeName { 117 get { return true; } 118 } 119 [Storable] 120 protected string description; 121 public string Description { 122 get { return description; } 123 set { 124 if (!CanChangeDescription) throw new NotSupportedException("Description cannot be changed."); 125 if (!(description.Equals(value) || (value == null) && (description == string.Empty))) { 126 description = value == null ? string.Empty : value; 127 OnDescriptionChanged(); 128 } 129 } 130 } 131 public virtual bool CanChangeDescription { 132 get { return true; } 133 } 134 135 public override string ToString() { 136 return Name; 137 } 138 139 public event EventHandler<CancelEventArgs<string>> NameChanging; 140 protected virtual void OnNameChanging(CancelEventArgs<string> e) { 141 var handler = NameChanging; 142 if (handler != null) handler(this, e); 143 } 144 145 public event EventHandler NameChanged; 146 protected virtual void OnNameChanged() { 147 var handler = NameChanged; 148 if (handler != null) handler(this, EventArgs.Empty); 149 OnToStringChanged(); 150 } 151 152 public event EventHandler DescriptionChanged; 153 protected virtual void OnDescriptionChanged() { 154 var handler = DescriptionChanged; 155 if (handler != null) handler(this, EventArgs.Empty); 156 } 157 #endregion 96 158 } 97 159 }
Note: See TracChangeset
for help on using the changeset viewer.