Changeset 1115


Ignore:
Timestamp:
01/12/09 19:09:40 (12 years ago)
Author:
gkronber
Message:

Removed calculation of R2 for the best (validation) model and added calculation of MAPE for training in the hard-coded StandardGP.
Changed Executer to store all model attributes. Changed parameters for StandardGP CEDMA runs for testing. (#419)

Location:
branches/CEDMA-Refactoring-Ticket419
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Server/Dispatcher.cs

    r1072 r1115  
    120120      StandardGP sgp = new StandardGP();
    121121      sgp.SetSeedRandomly = true;
    122       sgp.MaxGenerations = 1;
     122      sgp.MaxGenerations = 100;
    123123      sgp.PopulationSize = 1000;
    124124      sgp.Elites = 1;
  • branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Server/Executer.cs

    r1072 r1115  
    106106      store.Add(new Statement(modelEntity, Ontology.PredicateInstanceOf, Ontology.TypeGeneticProgrammingFunctionTree));
    107107      store.Add(new Statement(finishedExecution.DataSetEntity, Ontology.PredicateHasModel, modelEntity));
    108       Entity targetVariableAttr = new Entity(Ontology.CedmaNameSpace + Guid.NewGuid());
    109       store.Add(new Statement(modelEntity, Ontology.PredicateModelAttribute, targetVariableAttr));
    110       store.Add(new Statement(targetVariableAttr, Ontology.PredicateModelAttributeName, new Literal("TargetVariable")));
    111       store.Add(new Statement(targetVariableAttr, Ontology.PredicateModelAttributeValue, new Literal(finishedExecution.TargetVariable)));
    112       store.Add(new Statement(targetVariableAttr, Ontology.PredicateModelAttributeType, Ontology.TypeCategoricalAttribute));
     108      StoreModelAttribute(modelEntity, "TargetVariable", finishedExecution.TargetVariable);
     109      Scope bestModelScope = finishedEngine.GlobalScope.GetVariableValue<Scope>("BestValidationSolution", false);
     110      StoreModelAttribute(modelEntity, "TrainingMeanSquaredError", bestModelScope.GetVariableValue<DoubleData>("Quality", false).Data);
     111      StoreModelAttribute(modelEntity, "ValidationMeanSquaredError", bestModelScope.GetVariableValue<DoubleData>("ValidationQuality", false).Data);
     112      StoreModelAttribute(modelEntity, "TrainingMeanAbsolutePercentageError", bestModelScope.GetVariableValue<DoubleData>("TrainingMAPE", false).Data);
     113      StoreModelAttribute(modelEntity, "ValidationMeanAbsolutePercentageError", bestModelScope.GetVariableValue<DoubleData>("ValidationMAPE", false).Data);
     114      StoreModelAttribute(modelEntity, "TreeSize", bestModelScope.GetVariableValue<IntData>("TreeSize", false).Data);
     115      StoreModelAttribute(modelEntity, "TreeHeight", bestModelScope.GetVariableValue<IntData>("TreeHeight", false).Data);
     116      StoreModelAttribute(modelEntity, "EvaluatedSolutions", bestModelScope.GetVariableValue<IntData>("EvaluatedSolutions", false).Data);
     117       
     118      byte[] serializedModel = PersistenceManager.SaveToGZip(bestModelScope.GetVariableValue("FunctionTree", false));
     119      store.Add(new Statement(modelEntity, Ontology.PredicateSerializedData, new Literal(serializedModel)));
    113120
    114       Scope bestModelScope = finishedEngine.GlobalScope.GetVariableValue<Scope>("BestValidationSolution", false);
    115       double validationMape = bestModelScope.GetVariableValue<DoubleData>("ValidationMAPE", false).Data;
    116       Entity validationMapeAttr = new Entity(Ontology.CedmaNameSpace + Guid.NewGuid());
    117       store.Add(new Statement(modelEntity, Ontology.PredicateModelAttribute, validationMapeAttr));
    118       store.Add(new Statement(validationMapeAttr, Ontology.PredicateModelAttributeName, new Literal("ValidationMeanAbsolutePercentageError")));
    119       store.Add(new Statement(validationMapeAttr, Ontology.PredicateModelAttributeValue, new Literal(validationMape)));
    120       store.Add(new Statement(validationMapeAttr, Ontology.PredicateModelAttributeType, Ontology.TypeOrdinalAttribute));
     121    }
     122
     123    private void StoreModelAttribute(Entity model, string name, object value) {
     124      Entity attr = new Entity(Ontology.CedmaNameSpace + Guid.NewGuid());
     125      store.Add(new Statement(model, Ontology.PredicateModelAttribute, attr));
     126      store.Add(new Statement(attr, Ontology.PredicateModelAttributeName, new Literal(name)));
     127      store.Add(new Statement(attr, Ontology.PredicateModelAttributeValue, new Literal(value)));
     128      store.Add(new Statement(attr, Ontology.PredicateModelAttributeType, Ontology.TypeOrdinalAttribute));
    121129    }
    122130  }
  • branches/CEDMA-Refactoring-Ticket419/HeuristicLab.GP.StructureIdentification/StandardGP.cs

    r1074 r1115  
    332332      solutionStorer.GetVariableInfo("BestSolution").ActualName = "BestValidationSolution";
    333333      SequentialProcessor bestSolutionProcessor = new SequentialProcessor();
    334       MeanAbsolutePercentageErrorEvaluator mapeEvaluator = new MeanAbsolutePercentageErrorEvaluator();
    335       mapeEvaluator.Name = "ValidationMapeEvaluator";
    336       mapeEvaluator.GetVariableInfo("MAPE").ActualName = "ValidationMAPE";
    337       mapeEvaluator.GetVariableInfo("SamplesStart").ActualName = "ValidationSamplesStart";
    338       mapeEvaluator.GetVariableInfo("SamplesEnd").ActualName = "ValidationSamplesEnd";
    339       CoefficientOfDeterminationEvaluator r2Evaluator = new CoefficientOfDeterminationEvaluator();
    340       r2Evaluator.Name = "ValidationR2Evaluator";
    341       r2Evaluator.GetVariableInfo("R2").ActualName = "ValidationR2";
    342       r2Evaluator.GetVariableInfo("SamplesStart").ActualName = "ValidationSamplesStart";
    343       r2Evaluator.GetVariableInfo("SamplesEnd").ActualName = "ValidationSamplesEnd";
     334      MeanAbsolutePercentageErrorEvaluator trainingMapeEvaluator = new MeanAbsolutePercentageErrorEvaluator();
     335      trainingMapeEvaluator.Name = "ValidationMapeEvaluator";
     336      trainingMapeEvaluator.GetVariableInfo("MAPE").ActualName = "TrainingMAPE";
     337      trainingMapeEvaluator.GetVariableInfo("SamplesStart").ActualName = "TrainingSamplesStart";
     338      trainingMapeEvaluator.GetVariableInfo("SamplesEnd").ActualName = "TrainingSamplesEnd";
     339      MeanAbsolutePercentageErrorEvaluator validationMapeEvaluator = new MeanAbsolutePercentageErrorEvaluator();
     340      validationMapeEvaluator.Name = "ValidationMapeEvaluator";
     341      validationMapeEvaluator.GetVariableInfo("MAPE").ActualName = "ValidationMAPE";
     342      validationMapeEvaluator.GetVariableInfo("SamplesStart").ActualName = "ValidationSamplesStart";
     343      validationMapeEvaluator.GetVariableInfo("SamplesEnd").ActualName = "ValidationSamplesEnd";
    344344      ProgrammableOperator progOperator = new ProgrammableOperator();
    345345      progOperator.RemoveVariableInfo("Result");
     
    350350";
    351351      solutionStorer.AddSubOperator(bestSolutionProcessor);
    352       bestSolutionProcessor.AddSubOperator(mapeEvaluator);
    353       bestSolutionProcessor.AddSubOperator(r2Evaluator);
     352      bestSolutionProcessor.AddSubOperator(trainingMapeEvaluator);
     353      bestSolutionProcessor.AddSubOperator(validationMapeEvaluator);
    354354      bestSolutionProcessor.AddSubOperator(progOperator);
    355355      return solutionStorer;
Note: See TracChangeset for help on using the changeset viewer.