Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/27/09 13:22:41 (15 years ago)
Author:
gkronber
Message:

Added interface IModel and a standard implementation and changed SVM models to include the range transform in the model. #650 (IAlgorithm and derived interfaces should provide properties to retrieve results)

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

Legend:

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

    r1873 r1906  
    7070    }
    7171
     72    public virtual IModel Model {
     73      get {
     74        if (!engine.Terminated) throw new InvalidOperationException("The algorithm is still running. Wait until the algorithm is terminated to retrieve the result.");
     75        IScope bestModelScope = engine.GlobalScope.GetVariableValue<IScope>("BestValidationSolution", false);
     76        return CreateGPModel(bestModelScope);
     77      }
     78    }
     79
    7280    public virtual int Elites {
    7381      get { return GetVariableInjector().GetVariable("Elites").GetValue<IntData>().Data; }
     
    405413    }
    406414
     415    protected internal virtual Model CreateGPModel(IScope bestModelScope) {
     416      Model model = new Model();
     417      Dataset ds = bestModelScope.GetVariableValue<Dataset>("Dataset", true);
     418      model.Data = bestModelScope.GetVariableValue<IFunctionTree>("FunctionTree", false);
     419      model.Dataset = ds;
     420      model.TargetVariable = ds.GetVariableName(bestModelScope.GetVariableValue<IntData>("TargetVariable", true).Data);
     421      model.TrainingMeanSquaredError = bestModelScope.GetVariableValue<DoubleData>("Quality", false).Data;
     422      model.ValidationMeanSquaredError = bestModelScope.GetVariableValue<DoubleData>("ValidationQuality", false).Data;
     423      return model;
     424    }
     425
    407426    public override object Clone(IDictionary<Guid, object> clonedObjects) {
    408427      AlgorithmBase clone = (AlgorithmBase)base.Clone(clonedObjects);
  • trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/StandardGP.cs

    r1890 r1906  
    312312    }
    313313
     314    protected internal override Model CreateGPModel(IScope bestModelScope) {
     315      Model model = base.CreateGPModel(bestModelScope);
     316      model.TestMeanSquaredError = bestModelScope.GetVariableValue<DoubleData>("TestQuality", false).Data;
     317      return model;
     318    }
     319
    314320    public virtual IEditor CreateEditor() {
    315321      return new StandardGpEditor(this);
Note: See TracChangeset for help on using the changeset viewer.