Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/01/09 11:09:50 (15 years ago)
Author:
gkronber
Message:

Applied patch from mkommend for variable impact calculators and adapted data-modeling algorithms to use the new operators for variable impact calculation. #728

File:
1 edited

Legend:

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

    r2290 r2319  
    311311
    312312    protected internal virtual IOperator CreateBestSolutionProcessor() {
    313       return new EmptyOperator();
     313      SequentialProcessor seq = new SequentialProcessor();
     314      // calculate and set variable impacts
     315      VariableNamesExtractor namesExtractor = new VariableNamesExtractor();
     316      namesExtractor.GetVariableInfo("VariableNames").ActualName = "InputVariableNames";
     317      PredictorBuilder predictorBuilder = new PredictorBuilder();
     318
     319      VariableEvaluationImpactCalculator evaluationImpactCalculator = new VariableEvaluationImpactCalculator();
     320      evaluationImpactCalculator.GetVariableInfo("SamplesStart").ActualName = "ActualTrainingSamplesStart";
     321      evaluationImpactCalculator.GetVariableInfo("SamplesEnd").ActualName = "ActualTrainingSamplesEnd";
     322      VariableQualityImpactCalculator qualityImpactCalculator = new VariableQualityImpactCalculator();
     323      qualityImpactCalculator.GetVariableInfo("SamplesStart").ActualName = "ActualTrainingSamplesStart";
     324      qualityImpactCalculator.GetVariableInfo("SamplesEnd").ActualName = "ActualTrainingSamplesEnd";
     325
     326      seq.AddSubOperator(namesExtractor);
     327      seq.AddSubOperator(predictorBuilder);
     328      seq.AddSubOperator(evaluationImpactCalculator);
     329      seq.AddSubOperator(qualityImpactCalculator);
     330      return seq;
    314331    }
    315332
     
    410427
    411428    protected internal virtual IAnalyzerModel CreateGPModel(IScope bestModelScope) {
    412       Engine.GlobalScope.AddSubScope(bestModelScope);
    413       IGeneticProgrammingModel tree = bestModelScope.GetVariableValue<IGeneticProgrammingModel>("FunctionTree", false);
    414       ITreeEvaluator evaluator = bestModelScope.GetVariableValue<ITreeEvaluator>("TreeEvaluator", true);
    415429      IAnalyzerModel model = new AnalyzerModel();
    416       model.Predictor = new Predictor(evaluator, tree);
     430      model.Predictor = bestModelScope.GetVariableValue<IPredictor>("Predictor", true);
    417431      Dataset ds = bestModelScope.GetVariableValue<Dataset>("Dataset", true);
    418432      model.Dataset = ds;
     
    427441      model.TrainingMeanSquaredError = bestModelScope.GetVariableValue<DoubleData>("Quality", false).Data;
    428442      model.ValidationMeanSquaredError = bestModelScope.GetVariableValue<DoubleData>("ValidationQuality", false).Data;
    429       // calculate and set variable impacts
    430       VariableEvaluationImpactCalculator evaluationImpactCalculator = new VariableEvaluationImpactCalculator();
    431       evaluationImpactCalculator.GetVariableInfo("TrainingSamplesStart").ActualName = "ActualTrainingSamplesStart";
    432       evaluationImpactCalculator.GetVariableInfo("TrainingSamplesEnd").ActualName = "ActualTrainingSamplesEnd";
    433       VariableQualityImpactCalculator qualityImpactCalculator = new VariableQualityImpactCalculator();
    434       qualityImpactCalculator.GetVariableInfo("TrainingSamplesStart").ActualName = "ActualTrainingSamplesStart";
    435       qualityImpactCalculator.GetVariableInfo("TrainingSamplesEnd").ActualName = "ActualTrainingSamplesEnd";
    436        
    437 
    438       evaluationImpactCalculator.Apply(bestModelScope);
    439       qualityImpactCalculator.Apply(bestModelScope);
    440443
    441444      ItemList evaluationImpacts = bestModelScope.GetVariableValue<ItemList>("VariableEvaluationImpacts", false);
Note: See TracChangeset for help on using the changeset viewer.