Changeset 1906 for trunk/sources/HeuristicLab.GP.StructureIdentification
- Timestamp:
- 05/27/09 13:22:41 (15 years ago)
- 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 70 70 } 71 71 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 72 80 public virtual int Elites { 73 81 get { return GetVariableInjector().GetVariable("Elites").GetValue<IntData>().Data; } … … 405 413 } 406 414 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 407 426 public override object Clone(IDictionary<Guid, object> clonedObjects) { 408 427 AlgorithmBase clone = (AlgorithmBase)base.Clone(clonedObjects); -
trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/StandardGP.cs
r1890 r1906 312 312 } 313 313 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 314 320 public virtual IEditor CreateEditor() { 315 321 return new StandardGpEditor(this);
Note: See TracChangeset
for help on using the changeset viewer.