- Timestamp:
- 01/14/09 20:48:04 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Server/Executer.cs
r1116 r1130 103 103 104 104 private void StoreResults(Execution finishedExecution, ProcessingEngine finishedEngine) { 105 Entity model Entity= new Entity(Ontology.CedmaNameSpace + Guid.NewGuid());106 store.Add(new Statement(model Entity, Ontology.PredicateInstanceOf, Ontology.TypeGeneticProgrammingFunctionTree));107 store.Add(new Statement(finishedExecution.DataSetEntity, Ontology.PredicateHasModel, model Entity));108 StoreModelAttribute(model Entity, "TargetVariable", finishedExecution.TargetVariable);105 Entity model = new Entity(Ontology.CedmaNameSpace + Guid.NewGuid()); 106 store.Add(new Statement(model, Ontology.PredicateInstanceOf, Ontology.TypeGeneticProgrammingFunctionTree)); 107 store.Add(new Statement(finishedExecution.DataSetEntity, Ontology.PredicateHasModel, model)); 108 StoreModelAttribute(model, Ontology.TargetVariable, finishedExecution.TargetVariable); 109 109 Scope bestModelScope = finishedEngine.GlobalScope.GetVariableValue<Scope>("BestValidationSolution", false); 110 StoreModelAttribute(model Entity, "TrainingMeanSquaredError", bestModelScope.GetVariableValue<DoubleData>("Quality", false).Data);111 StoreModelAttribute(model Entity, "ValidationMeanSquaredError", bestModelScope.GetVariableValue<DoubleData>("ValidationQuality", false).Data);112 StoreModelAttribute(model Entity, "TrainingMeanAbsolutePercentageError", bestModelScope.GetVariableValue<DoubleData>("TrainingMAPE", false).Data);113 StoreModelAttribute(model Entity, "ValidationMeanAbsolutePercentageError", bestModelScope.GetVariableValue<DoubleData>("ValidationMAPE", false).Data);114 StoreModelAttribute(model Entity, "TreeSize", bestModelScope.GetVariableValue<IntData>("TreeSize", false).Data);115 StoreModelAttribute(model Entity, "TreeHeight", bestModelScope.GetVariableValue<IntData>("TreeHeight", false).Data);116 StoreModelAttribute(model Entity, "EvaluatedSolutions", bestModelScope.GetVariableValue<IntData>("EvaluatedSolutions", false).Data);110 StoreModelAttribute(model, Ontology.TrainingMeanSquaredError, bestModelScope.GetVariableValue<DoubleData>("Quality", false).Data); 111 StoreModelAttribute(model, Ontology.ValidationMeanSquaredError, bestModelScope.GetVariableValue<DoubleData>("ValidationQuality", false).Data); 112 StoreModelAttribute(model, Ontology.TrainingMeanAbsolutePercentageError, bestModelScope.GetVariableValue<DoubleData>("TrainingMAPE", false).Data); 113 StoreModelAttribute(model, Ontology.ValidationMeanAbsolutePercentageError, bestModelScope.GetVariableValue<DoubleData>("ValidationMAPE", false).Data); 114 StoreModelAttribute(model, Ontology.TreeSize, bestModelScope.GetVariableValue<IntData>("TreeSize", false).Data); 115 StoreModelAttribute(model, Ontology.TreeHeight, bestModelScope.GetVariableValue<IntData>("TreeHeight", false).Data); 116 StoreModelAttribute(model, Ontology.EvaluatedSolutions, bestModelScope.GetVariableValue<IntData>("EvaluatedSolutions", false).Data); 117 117 118 118 byte[] serializedModel = PersistenceManager.SaveToGZip(bestModelScope.GetVariableValue("FunctionTree", false)); 119 store.Add(new Statement(modelEntity, Ontology.PredicateSerializedData, new Literal(Convert.ToBase64String(serializedModel)))); 119 store.Add(new Statement(model, Ontology.PredicateSerializedData, new Literal(Convert.ToBase64String(serializedModel)))); 120 } 120 121 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)); 122 private void StoreModelAttribute(Entity model, Entity predicate, object value) { 123 store.Add(new Statement(model, predicate, new Literal(value))); 129 124 } 130 125 }
Note: See TracChangeset
for help on using the changeset viewer.