Changeset 9392 for branches/LearningClassifierSystems/HeuristicLab.Encodings.DecisionList/3.3/Variable/DoubleVariable.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/Variable/DoubleVariable.cs
r9342 r9392 46 46 protected DoubleVariable(DoubleVariable original, Cloner cloner) 47 47 : base(original, cloner) { 48 discretizer = (IDiscretizer)original.discretizer.Clone(); 49 curIntervals = new List<int>(original.curIntervals); 48 if (original.discretizer != null) { 49 discretizer = (IDiscretizer)original.discretizer.Clone(); 50 curIntervals = new List<int>(original.curIntervals); 51 } 50 52 maxIntervals = original.maxIntervals; 51 53 } … … 68 70 69 71 attributes = new List<bool>(numberOfIntervals); 70 varcurIntervals = new List<int>(numberOfIntervals);72 curIntervals = new List<int>(numberOfIntervals); 71 73 72 74 for (int i = 0; i < numberOfIntervals - 1; i++) { … … 74 76 microIntervals -= microInt; 75 77 curIntervals.Add(microInt); 76 attributes [i] = random.NextDouble() < onePercentage;78 attributes.Add(random.NextDouble() < onePercentage); 77 79 } 78 80 // add last interval 79 81 curIntervals.Add(microIntervals); 80 attributes [numberOfIntervals - 1] = random.NextDouble() < onePercentage;82 attributes.Add(random.NextDouble() < onePercentage); 81 83 } 82 84 … … 114 116 } 115 117 116 private IList<double> GetValuesToCutPoints(IEnumerable<double> cutpoints, I Enumerable<int> microIntervals) {118 private IList<double> GetValuesToCutPoints(IEnumerable<double> cutpoints, IList<int> microIntervals) { 117 119 var intervalValues = new List<double>(); 118 120 var cutpointList = cutpoints.ToList(); 119 int cur = 0;120 for each (var microInterval in microIntervals) {121 cur += microInterval ;121 int cur = -1; 122 for (int i = 0; i < microIntervals.Count - 1; i++) { 123 cur += microIntervals[i]; 122 124 intervalValues.Add(cutpointList[cur]); 123 125 } 126 intervalValues.Add(Double.PositiveInfinity); 124 127 return intervalValues; 125 128 }
Note: See TracChangeset
for help on using the changeset viewer.