Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/11/13 13:32:32 (11 years ago)
Author:
sforsten
Message:

#1980:

  • set plugin dependencies
  • added smart initialization
  • added hierarchical selection
  • fixed major and minor default rule
  • fixed several smaller bugs
  • some refactoring has been done
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  
    191191    public override void Reinitialize(IRandom random, double onePercentage, IEnumerable<IDiscretizer> descretizers) {
    192192      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;
    194203    }
    195204  }
  • branches/LearningClassifierSystems/HeuristicLab.Encodings.DecisionList/3.3/Variable/IVariable.cs

    r9342 r9605  
    2727namespace HeuristicLab.Encodings.DecisionList {
    2828  public interface IVariable : IItem {
     29    double Length { get; }
    2930    string VariableName { get; }
    3031    Type VariableType { get; }
     
    4344
    4445    void Split(IRandom Random);
     46
     47    void SetToMatch(string variableValue);
    4548  }
    4649}
  • branches/LearningClassifierSystems/HeuristicLab.Encodings.DecisionList/3.3/Variable/IntVariable.cs

    r9334 r9605  
    6868      return attributes[possibleFeatures.IndexOf(input)];
    6969    }
     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    }
    7077  }
    7178}
  • branches/LearningClassifierSystems/HeuristicLab.Encodings.DecisionList/3.3/Variable/StringVariable.cs

    r9334 r9605  
    6464      return attributes[possibleFeatures.IndexOf(input)];
    6565    }
     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    }
    6673  }
    6774}
  • branches/LearningClassifierSystems/HeuristicLab.Encodings.DecisionList/3.3/Variable/Variable.cs

    r9352 r9605  
    3838    }
    3939
     40    public double Length {
     41      get { return attributes.Count; }
     42    }
     43
    4044    [Storable]
    4145    protected string variableName;
     
    7276    public abstract bool Match(string input);
    7377
     78    public abstract void SetToMatch(string variableValue);
     79
    7480    public virtual string ToFullString() { throw new NotImplementedException(); }
    7581
Note: See TracChangeset for help on using the changeset viewer.