Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
10/20/09 11:20:13 (15 years ago)
Author:
gkronber
Message:

Fixed #784 (ProblemInjector should be changed to read variable names instead of indexes for input and target variables)

Location:
trunk/sources/HeuristicLab.GP.StructureIdentification.Classification/3.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.GP.StructureIdentification.Classification/3.3/MulticlassModeller.cs

    r2328 r2440  
    4747      : base() {
    4848      AddVariableInfo(new VariableInfo(DATASET, "The original dataset and the new dataset parts in the newly created subscopes", typeof(Dataset), VariableKind.In));
    49       AddVariableInfo(new VariableInfo(TARGETVARIABLE, "TargetVariable", typeof(IntData), VariableKind.In));
     49      AddVariableInfo(new VariableInfo(TARGETVARIABLE, "TargetVariable", typeof(StringData), VariableKind.In));
    5050      AddVariableInfo(new VariableInfo(TARGETCLASSVALUES, "Class values of the target variable in the original dataset and in the new dataset parts", typeof(ItemList<DoubleData>), VariableKind.In | VariableKind.New));
    5151      AddVariableInfo(new VariableInfo(CLASSAVALUE, "The original class value of the new class A", typeof(DoubleData), VariableKind.New));
     
    5959    public override IOperation Apply(IScope scope) {
    6060      Dataset origDataset = GetVariableValue<Dataset>(DATASET, scope, true);
    61       int targetVariable = GetVariableValue<IntData>(TARGETVARIABLE, scope, true).Data;
     61      int targetVariable = origDataset.GetVariableIndex(GetVariableValue<StringData>(TARGETVARIABLE, scope, true).Data);
    6262      ItemList<DoubleData> classValues = GetVariableValue<ItemList<DoubleData>>(TARGETCLASSVALUES, scope, true);
    6363      int origTrainingSamplesStart = GetVariableValue<IntData>(TRAININGSAMPLESSTART, scope, true).Data;
  • trunk/sources/HeuristicLab.GP.StructureIdentification.Classification/3.3/MulticlassOneVsOneAnalyzer.cs

    r2328 r2440  
    5252      : base() {
    5353      AddVariableInfo(new VariableInfo(DATASET, "The dataset to use", typeof(Dataset), VariableKind.In));
    54       AddVariableInfo(new VariableInfo(TARGETVARIABLE, "Target variable", typeof(IntData), VariableKind.In));
     54      AddVariableInfo(new VariableInfo(TARGETVARIABLE, "Target variable", typeof(StringData), VariableKind.In));
    5555      AddVariableInfo(new VariableInfo(TARGETCLASSVALUES, "Class values of the target variable in the original dataset", typeof(ItemList<DoubleData>), VariableKind.In));
    5656      AddVariableInfo(new VariableInfo(CLASSAVALUE, "The original class value of the class A in the subscope", typeof(DoubleData), VariableKind.In));
     
    6767    public override IOperation Apply(IScope scope) {
    6868      Dataset dataset = GetVariableValue<Dataset>(DATASET, scope, true);
    69       int targetVariable = GetVariableValue<IntData>(TARGETVARIABLE, scope, true).Data;
     69      string targetVariable = GetVariableValue<StringData>(TARGETVARIABLE, scope, true).Data;
     70      int targetVariableIndex = dataset.GetVariableIndex(targetVariable);
    7071      int trainingSamplesStart = GetVariableValue<IntData>(TRAININGSAMPLESSTART, scope, true).Data;
    7172      int trainingSamplesEnd = GetVariableValue<IntData>(TRAININGSAMPLESEND, scope, true).Data;
     
    9596      int correctlyClassified = 0;
    9697      for(int i = 0; i < (samplesEnd - samplesStart); i++) {
    97         double originalClassValue = dataset.GetValue(i + samplesStart, targetVariable);
     98        double originalClassValue = dataset.GetValue(i + samplesStart, targetVariableIndex);
    9899        double estimatedClassValue = classValues[0].Data;
    99100        int maxVotes = votes[i, 0];
Note: See TracChangeset for help on using the changeset viewer.