Changeset 9392 for branches/LearningClassifierSystems/HeuristicLab.Encodings.DecisionList/3.3/DecisionListSolution.cs
- Timestamp:
- 04/23/13 13:31:29 (11 years ago)
- Location:
- branches/LearningClassifierSystems/HeuristicLab.Encodings.DecisionList/3.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/LearningClassifierSystems/HeuristicLab.Encodings.DecisionList/3.3
- Property svn:ignore
-
old new 1 1 *.user 2 2 Plugin.cs 3 obj
-
- Property svn:ignore
-
branches/LearningClassifierSystems/HeuristicLab.Encodings.DecisionList/3.3/DecisionListSolution.cs
r9334 r9392 27 27 using HeuristicLab.Data; 28 28 using HeuristicLab.Optimization; 29 using HeuristicLab.Optimization.Operators.LCS; 29 30 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 30 31 … … 38 39 private const string TestAccuracyResultName = "Accuracy (test)"; 39 40 private const string TrainingNumberOfAliveRulesName = "Number of alive rules (training)"; 41 private const string TrainingAliveRulesName = "Alive Rules (training)"; 40 42 //private const string TestNumberOfAliveRules = "Number of alive rules (test)"; 41 43 private const string TrainingTheoryLengthName = "Theory Length (training)"; … … 54 56 private set { ((IntValue)this[TrainingNumberOfAliveRulesName].Value).Value = value; } 55 57 } 58 public ItemSet<Rule> TrainingAliveRules { 59 get { return (ItemSet<Rule>)this[TrainingAliveRulesName].Value; } 60 private set { this[TrainingAliveRulesName].Value = value; } 61 } 56 62 public double TrainingTheoryLength { 57 63 get { return ((DoubleValue)this[TrainingTheoryLengthName].Value).Value; } … … 61 67 get { return ((DoubleValue)this[TrainingExceptionsLengthName].Value).Value; } 62 68 private set { ((DoubleValue)this[TrainingExceptionsLengthName].Value).Value = value; } 69 } 70 71 public int Classes { 72 get { return ProblemData.Classes; } 63 73 } 64 74 … … 79 89 } 80 90 81 public I DecisionListClassificationProblemData ProblemData {82 get { return (I DecisionListClassificationProblemData)this[ProblemDataResultName].Value; }91 public IGAssistNichesProblemData ProblemData { 92 get { return (IGAssistNichesProblemData)this[ProblemDataResultName].Value; } 83 93 set { 84 94 if (this[ProblemDataResultName].Value != value) { … … 100 110 description = original.Description; 101 111 } 102 public DecisionListSolution(DecisionList model, I DecisionListClassificationProblemData problemData)112 public DecisionListSolution(DecisionList model, IGAssistNichesProblemData problemData) 103 113 : base() { 104 114 name = ItemName; … … 109 119 Add(new Result(TestAccuracyResultName, "Accuracy of the model on the test partition (percentage of correctly classified instances).", new PercentValue())); 110 120 Add(new Result(TrainingNumberOfAliveRulesName, "", new IntValue())); 121 Add(new Result(TrainingAliveRulesName, "", new ItemSet<Rule>())); 111 122 Add(new Result(TrainingTheoryLengthName, "", new DoubleValue())); 112 123 Add(new Result(TrainingExceptionsLengthName, "", new DoubleValue())); … … 123 134 var originalTrainingCondition = ProblemData.FetchInput(ProblemData.TrainingIndices); 124 135 var originalTestCondition = ProblemData.FetchInput(ProblemData.TestIndices); 125 int numberOfAliveRules;136 ItemSet<Rule> aliveRules; 126 137 double theoryLength; 127 var estimatedTraining = Model.Evaluate(originalTrainingCondition, out numberOfAliveRules, out theoryLength); 128 TrainingNumberOfAliveRules = numberOfAliveRules; 138 var estimatedTraining = Model.Evaluate(originalTrainingCondition, out aliveRules, out theoryLength); 139 TrainingNumberOfAliveRules = aliveRules.Count; 140 TrainingAliveRules = aliveRules; 129 141 TrainingTheoryLength = theoryLength; 130 142 var estimatedTest = Model.Evaluate(originalTestCondition); … … 139 151 } 140 152 141 p rivate double CalculateAccuracy(IEnumerable<IAction> original, IEnumerable<IAction> estimated) {153 public static double CalculateAccuracy(IEnumerable<IGAssistNiche> original, IEnumerable<IGAssistNiche> estimated) { 142 154 double correctClassified = 0; 143 155 … … 147 159 148 160 while (originalEnumerator.MoveNext() && estimatedActionEnumerator.MoveNext()) { 149 if (originalEnumerator.Current.Match(estimatedActionEnumerator.Current)) { 161 if (originalEnumerator.Current != null && estimatedActionEnumerator.Current != null 162 && originalEnumerator.Current.SameNiche(estimatedActionEnumerator.Current)) { 150 163 correctClassified++; 151 164 }
Note: See TracChangeset
for help on using the changeset viewer.