Changeset 9605 for branches/LearningClassifierSystems/HeuristicLab.Encodings.DecisionList/3.3/Variable
- Timestamp:
- 06/11/13 13:32:32 (11 years ago)
- Location:
- branches/LearningClassifierSystems/HeuristicLab.Encodings.DecisionList/3.3/Variable
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/LearningClassifierSystems/HeuristicLab.Encodings.DecisionList/3.3/Variable/DoubleVariable.cs
r9392 r9605 191 191 public override void Reinitialize(IRandom random, double onePercentage, IEnumerable<IDiscretizer> descretizers) { 192 192 Randomize(random, onePercentage, descretizers); 193 return; 193 } 194 195 public override void SetToMatch(string variableValue) { 196 var value = double.Parse(variableValue); 197 var realCutpoints = GetValuesToCutPoints(discretizer.GetCutPoints(variableName), curIntervals); 198 int pos = 0; 199 while (value >= realCutpoints[pos]) { 200 pos++; 201 } 202 attributes[pos] = true; 194 203 } 195 204 } -
branches/LearningClassifierSystems/HeuristicLab.Encodings.DecisionList/3.3/Variable/IVariable.cs
r9342 r9605 27 27 namespace HeuristicLab.Encodings.DecisionList { 28 28 public interface IVariable : IItem { 29 double Length { get; } 29 30 string VariableName { get; } 30 31 Type VariableType { get; } … … 43 44 44 45 void Split(IRandom Random); 46 47 void SetToMatch(string variableValue); 45 48 } 46 49 } -
branches/LearningClassifierSystems/HeuristicLab.Encodings.DecisionList/3.3/Variable/IntVariable.cs
r9334 r9605 68 68 return attributes[possibleFeatures.IndexOf(input)]; 69 69 } 70 71 public override void SetToMatch(string variableValue) { 72 var value = int.Parse(variableValue); 73 if (!possibleFeatures.Contains(value)) throw new ArgumentException("variableValue " + variableValue + " is not a possible value of variable " + variableName); 74 75 attributes[possibleFeatures.IndexOf(value)] = true; 76 } 70 77 } 71 78 } -
branches/LearningClassifierSystems/HeuristicLab.Encodings.DecisionList/3.3/Variable/StringVariable.cs
r9334 r9605 64 64 return attributes[possibleFeatures.IndexOf(input)]; 65 65 } 66 67 public override void SetToMatch(string variableValue) { 68 var valueIndex = possibleFeatures.IndexOf(variableValue); 69 if (valueIndex == -1) throw new ArgumentException("variableValue " + variableValue + " is not a possible value of variable " + variableName); 70 71 attributes[valueIndex] = true; 72 } 66 73 } 67 74 } -
branches/LearningClassifierSystems/HeuristicLab.Encodings.DecisionList/3.3/Variable/Variable.cs
r9352 r9605 38 38 } 39 39 40 public double Length { 41 get { return attributes.Count; } 42 } 43 40 44 [Storable] 41 45 protected string variableName; … … 72 76 public abstract bool Match(string input); 73 77 78 public abstract void SetToMatch(string variableValue); 79 74 80 public virtual string ToFullString() { throw new NotImplementedException(); } 75 81
Note: See TracChangeset
for help on using the changeset viewer.