Last change
on this file since 18046 was
18046,
checked in by dpiringe, 3 years ago
|
#3026
- added a first version of a new feature called ResultCollectionPostProcessors, which should transform/process the results of an optimizer run
- created a new interface IResultCollectionPostProcessor
- created a new class SymRegPythonPostProcessor, which formats all ISymbolicRegressionSolution with the usage of the SymbolicDataAnalysisExpressionPythonFormatter
- changed the generation and instantiation of templates to handle this new feature
- the template files contains a new area PostProcessors
- added functionality in Runner to use these new type of result processing
- added a new tab in ExportJsonDialog to configure PostProcessors
|
File size:
1.3 KB
|
Line | |
---|
1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Linq;
|
---|
4 | using System.Text;
|
---|
5 | using System.Threading.Tasks;
|
---|
6 | using HeuristicLab.Collections;
|
---|
7 | using HeuristicLab.Common;
|
---|
8 | using HeuristicLab.Core;
|
---|
9 | using HeuristicLab.Optimization;
|
---|
10 | using HeuristicLab.Problems.DataAnalysis.Symbolic;
|
---|
11 | using HeuristicLab.Problems.DataAnalysis.Symbolic.Regression;
|
---|
12 | using HEAL.Attic;
|
---|
13 |
|
---|
14 | namespace HeuristicLab.JsonInterface {
|
---|
15 | [StorableType("844F2887-B7A0-4BD4-89B8-F9155C65D214")]
|
---|
16 | public class SymRegPythonPostProcessor : Item, IResultCollectionPostProcessor {
|
---|
17 |
|
---|
18 | [StorableConstructor]
|
---|
19 | protected SymRegPythonPostProcessor(StorableConstructorFlag _) : base(_) {
|
---|
20 | }
|
---|
21 |
|
---|
22 | public SymRegPythonPostProcessor() { }
|
---|
23 | public SymRegPythonPostProcessor(SymRegPythonPostProcessor old, Cloner cloner) { }
|
---|
24 |
|
---|
25 | public void Apply(IObservableDictionary<string, IItem> results, IDictionary<string, string> output) {
|
---|
26 | var formatter = new SymbolicDataAnalysisExpressionPythonFormatter();
|
---|
27 | foreach (var kvp in results) {
|
---|
28 | if (kvp.Value is ISymbolicRegressionSolution sol) {
|
---|
29 | output.Add(kvp.Key, formatter.Format(sol.Model.SymbolicExpressionTree));
|
---|
30 | }
|
---|
31 | }
|
---|
32 | }
|
---|
33 |
|
---|
34 |
|
---|
35 | public override IDeepCloneable Clone(Cloner cloner) {
|
---|
36 | return new SymRegPythonPostProcessor(this, cloner);
|
---|
37 | }
|
---|
38 | }
|
---|
39 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.