Changeset 2454


Ignore:
Timestamp:
10/29/09 16:07:55 (12 years ago)
Author:
gkronber
Message:

Implemented NodeBasedVariableImpactCalculator. #793

Location:
trunk/sources
Files:
1 added
10 edited

Legend:

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

    r2385 r2454  
    155155      solutionProc.AddSubOperator(namesExtractor);
    156156      solutionProc.AddSubOperator(predictorBuilder);
     157      VariableQualityImpactCalculator qualityImpactCalculator = new VariableQualityImpactCalculator();
     158      qualityImpactCalculator.GetVariableInfo("SamplesStart").ActualName = "ValidationSamplesStart";
     159      qualityImpactCalculator.GetVariableInfo("SamplesEnd").ActualName = "ValidationSamplesEnd";
     160
     161      solutionProc.AddSubOperator(qualityImpactCalculator);
     162
     163      NodeBasedVariableImpactCalculator nodeImpactCalculator = new NodeBasedVariableImpactCalculator();
     164      nodeImpactCalculator.GetVariableInfo("SamplesStart").ActualName = "ValidationSamplesStart";
     165      nodeImpactCalculator.GetVariableInfo("SamplesEnd").ActualName = "ValidationSamplesEnd";
     166
     167      solutionProc.AddSubOperator(nodeImpactCalculator);
     168
    157169      #endregion
    158170
     
    165177      model.SetMetaData("TreeSize", gpModel.Size);
    166178      model.SetMetaData("TreeHeight", gpModel.Height);
     179      #region variable impacts
     180      ItemList qualityImpacts = bestModelScope.GetVariableValue<ItemList>(ModelingResult.VariableQualityImpact.ToString(), false);
     181      foreach (ItemList row in qualityImpacts) {
     182        string variableName = ((StringData)row[0]).Data;
     183        double impact = ((DoubleData)row[1]).Data;
     184        model.SetVariableResult(ModelingResult.VariableQualityImpact, variableName, impact);
     185        model.AddInputVariable(variableName);
     186      }
     187      ItemList nodeImpacts = bestModelScope.GetVariableValue<ItemList>(ModelingResult.VariableNodeImpact.ToString(), false);
     188      foreach (ItemList row in nodeImpacts) {
     189        string variableName = ((StringData)row[0]).Data;
     190        double impact = ((DoubleData)row[1]).Data;
     191        model.SetVariableResult(ModelingResult.VariableNodeImpact, variableName, impact);
     192        model.AddInputVariable(variableName);
     193      }
     194      #endregion
     195
    167196    }
    168197  }
  • trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/HeuristicLab.GP.StructureIdentification-3.3.csproj

    r2361 r2454  
    3636    <DebugSymbols>true</DebugSymbols>
    3737    <OutputPath>bin\x86\Debug\</OutputPath>
    38     <DefineConstants>DEBUG;TRACE</DefineConstants>
     38    <DefineConstants>TRACE;DEBUG</DefineConstants>
    3939    <DebugType>full</DebugType>
    4040    <PlatformTarget>x86</PlatformTarget>
     
    4848    <PlatformTarget>x86</PlatformTarget>
    4949    <ErrorReport>prompt</ErrorReport>
     50    <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
    5051  </PropertyGroup>
    5152  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
     
    8586    <Compile Include="BaseClasses\TreeEvaluatorBase.cs" />
    8687    <Compile Include="DefaultStructureIdentificationOperators.cs" />
     88    <Compile Include="Evaluators\NodeBasedVariableImpactCalculator.cs" />
    8789    <Compile Include="HL3TreeEvaluatorInjector.cs" />
    8890    <Compile Include="HL2TreeEvaluatorInjector.cs" />
  • trunk/sources/HeuristicLab.LinearRegression/3.2/LinearClassification.cs

    r2363 r2454  
    5454    }
    5555
    56     protected override IAnalyzerModel CreateLRModel(IScope bestModelScope) {
    57       var model = new AnalyzerModel();
     56    protected override void CreateSpecificLRModel(IScope bestModelScope, IAnalyzerModel model) {
    5857      DefaultClassificationOperators.PopulateAnalyzerModel(bestModelScope, model);
    59       return model;
    6058    }
    6159  }
  • trunk/sources/HeuristicLab.LinearRegression/3.2/LinearRegression.cs

    r2440 r2454  
    215215      seq.AddSubOperator(namesExtractor);
    216216      seq.AddSubOperator(predictorBuilder);
     217      VariableQualityImpactCalculator qualityImpactCalculator = new VariableQualityImpactCalculator();
     218      qualityImpactCalculator.GetVariableInfo("SamplesStart").ActualName = "TrainingSamplesStart";
     219      qualityImpactCalculator.GetVariableInfo("SamplesEnd").ActualName = "TrainingSamplesEnd";
     220
     221      seq.AddSubOperator(qualityImpactCalculator);
    217222      #endregion
    218223
    219224      seq.AddSubOperator(CreateModelAnalyzerOperator());
     225
     226
     227
    220228
    221229      op.OperatorGraph.AddOperator(seq);
     
    230238    protected virtual IAnalyzerModel CreateLRModel(IScope bestModelScope) {
    231239      var model = new AnalyzerModel();
     240      CreateSpecificLRModel(bestModelScope, model);
     241      #region variable impacts
     242      ItemList qualityImpacts = bestModelScope.GetVariableValue<ItemList>(ModelingResult.VariableQualityImpact.ToString(), false);
     243      foreach (ItemList row in qualityImpacts) {
     244        string variableName = ((StringData)row[0]).Data;
     245        double impact = ((DoubleData)row[1]).Data;
     246        model.SetVariableResult(ModelingResult.VariableQualityImpact, variableName, impact);
     247        model.AddInputVariable(variableName);
     248      }
     249      #endregion
     250      return model;
     251    }
     252
     253    protected virtual void CreateSpecificLRModel(IScope bestModelScope, IAnalyzerModel model) {
    232254      DefaultRegressionOperators.PopulateAnalyzerModel(bestModelScope, model);
    233       return model;
    234255    }
    235256
     
    257278    #region persistence
    258279    public override object Clone(IDictionary<Guid, object> clonedObjects) {
    259       LinearRegression clone = (LinearRegression) base.Clone(clonedObjects);
     280      LinearRegression clone = (LinearRegression)base.Clone(clonedObjects);
    260281      clone.engine = (IEngine)Auxiliary.Clone(Engine, clonedObjects);
    261282      return clone;
  • trunk/sources/HeuristicLab.LinearRegression/3.2/LinearTimeSeriesPrognosis.cs

    r2363 r2454  
    7373    }
    7474
    75     protected override IAnalyzerModel CreateLRModel(IScope bestModelScope) {
    76       var model = new AnalyzerModel();
     75    protected override void CreateSpecificLRModel(IScope bestModelScope, IAnalyzerModel model) {
    7776      DefaultTimeSeriesOperators.PopulateAnalyzerModel(bestModelScope, model);
    78       return model;
    7977    }
    8078  }
  • trunk/sources/HeuristicLab.Modeling/3.2/DefaultModelAnalyzerOperators.cs

    r2440 r2454  
    3737      }
    3838
    39       #region variable impacts
    40       VariableEvaluationImpactCalculator evaluationImpactCalculator = new VariableEvaluationImpactCalculator();
    41       evaluationImpactCalculator.GetVariableInfo("SamplesStart").ActualName = "TrainingSamplesStart";
    42       evaluationImpactCalculator.GetVariableInfo("SamplesEnd").ActualName = "TrainingSamplesEnd";
    43       VariableQualityImpactCalculator qualityImpactCalculator = new VariableQualityImpactCalculator();
    44       qualityImpactCalculator.GetVariableInfo("SamplesStart").ActualName = "TrainingSamplesStart";
    45       qualityImpactCalculator.GetVariableInfo("SamplesEnd").ActualName = "TrainingSamplesEnd";
    46 
    47       seq.AddSubOperator(evaluationImpactCalculator);
    48       seq.AddSubOperator(qualityImpactCalculator);
    49       #endregion
    50 
    5139      op.OperatorGraph.AddOperator(seq);
    5240      op.OperatorGraph.InitialOperator = seq;
     
    7260      }
    7361
    74       ItemList evaluationImpacts = modelScope.GetVariableValue<ItemList>(ModelingResult.VariableEvaluationImpact.ToString(), false);
    75       ItemList qualityImpacts = modelScope.GetVariableValue<ItemList>(ModelingResult.VariableQualityImpact.ToString(), false);
    76       foreach (ItemList row in evaluationImpacts) {
    77         string variableName = ((StringData)row[0]).Data;
    78         double impact = ((DoubleData)row[1]).Data;
    79         model.SetVariableResult(ModelingResult.VariableEvaluationImpact, variableName, impact);
    80         model.AddInputVariable(variableName);
    81       }
    82       foreach (ItemList row in qualityImpacts) {
    83         string variableName = ((StringData)row[0]).Data;
    84         double impact = ((DoubleData)row[1]).Data;
    85         model.SetVariableResult(ModelingResult.VariableQualityImpact, variableName, impact);
    86         model.AddInputVariable(variableName);
    87       }
    88 
    8962      return model;
    9063    }
  • trunk/sources/HeuristicLab.Modeling/3.2/ModelingResult.cs

    r2428 r2454  
    7676
    7777    VariableQualityImpact,
    78     VariableEvaluationImpact
     78    VariableEvaluationImpact,
     79    VariableNodeImpact
    7980  }
    8081}
  • trunk/sources/HeuristicLab.SupportVectorMachines/3.2/SupportVectorClassification.cs

    r2356 r2454  
    5454
    5555
    56     protected override IAnalyzerModel CreateSVMModel(IScope bestModelScope) {
    57       IAnalyzerModel model = new AnalyzerModel();
    58       model.SetMetaData("Cost", bestModelScope.GetVariableValue<DoubleData>("Cost", false).Data);
    59       model.SetMetaData("Nu", bestModelScope.GetVariableValue<DoubleData>("Nu", false).Data);
     56    protected override void CreateSpecificSVMModel(IScope bestModelScope, IAnalyzerModel model) {
    6057      DefaultClassificationOperators.PopulateAnalyzerModel(bestModelScope, model);
    61       return model;
    6258    }
    6359  }
  • trunk/sources/HeuristicLab.SupportVectorMachines/3.2/SupportVectorRegression.cs

    r2440 r2454  
    453453      seqProc.AddSubOperator(CreateEvaluator("Training"));
    454454      seqProc.AddSubOperator(predictorBuilder);
     455
     456      #region variable impacts
     457      VariableQualityImpactCalculator qualityImpactCalculator = new VariableQualityImpactCalculator();
     458      qualityImpactCalculator.GetVariableInfo("SamplesStart").ActualName = "ValidationSamplesStart";
     459      qualityImpactCalculator.GetVariableInfo("SamplesEnd").ActualName = "ValidationSamplesEnd";
     460
     461      seqProc.AddSubOperator(qualityImpactCalculator);
     462      #endregion
     463
     464
    455465      seqProc.AddSubOperator(CreateModelAnalyzerOperator());
    456466
     
    470480      model.SetMetaData("Cost", bestModelScope.GetVariableValue<DoubleData>("Cost", false).Data);
    471481      model.SetMetaData("Nu", bestModelScope.GetVariableValue<DoubleData>("Nu", false).Data);
     482      #region variable impacts
     483      ItemList qualityImpacts = bestModelScope.GetVariableValue<ItemList>(ModelingResult.VariableQualityImpact.ToString(), false);
     484      foreach (ItemList row in qualityImpacts) {
     485        string variableName = ((StringData)row[0]).Data;
     486        double impact = ((DoubleData)row[1]).Data;
     487        model.SetVariableResult(ModelingResult.VariableQualityImpact, variableName, impact);
     488        model.AddInputVariable(variableName);
     489      }
     490      #endregion
     491
     492      CreateSpecificSVMModel(bestModelScope, model);
     493
     494      return model;
     495    }
     496
     497    protected virtual void CreateSpecificSVMModel(IScope bestModelScope, IAnalyzerModel model) {
    472498      DefaultRegressionOperators.PopulateAnalyzerModel(bestModelScope, model);
    473 
    474       return model;
    475499    }
    476500
     
    498522    #region persistence
    499523    public override object Clone(IDictionary<Guid, object> clonedObjects) {
    500       SupportVectorRegression clone = (SupportVectorRegression) base.Clone(clonedObjects);
     524      SupportVectorRegression clone = (SupportVectorRegression)base.Clone(clonedObjects);
    501525      clone.engine = (IEngine)Auxiliary.Clone(Engine, clonedObjects);
    502526      return clone;
  • trunk/sources/HeuristicLab.SupportVectorMachines/3.2/SupportVectorTimeSeriesPrognosis.cs

    r2361 r2454  
    7272    }
    7373
    74     protected override IAnalyzerModel CreateSVMModel(IScope bestModelScope) {
    75       var model = new AnalyzerModel();
    76       model.SetMetaData("Cost", bestModelScope.GetVariableValue<DoubleData>("Cost", false).Data);
    77       model.SetMetaData("Nu", bestModelScope.GetVariableValue<DoubleData>("Nu", false).Data);
     74    protected override void CreateSpecificSVMModel(IScope bestModelScope, IAnalyzerModel model) {
    7875      DefaultTimeSeriesOperators.PopulateAnalyzerModel(bestModelScope, model);
    79       return model;
    8076    }
    8177  }
Note: See TracChangeset for help on using the changeset viewer.