Changeset 18050 for branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/ResultCollectionProcessors
- Timestamp:
- 09/08/21 15:53:37 (3 years ago)
- Location:
- branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/ResultCollectionProcessors
- Files:
-
- 1 added
- 1 deleted
- 1 copied
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/ResultCollectionProcessors/SymRegPythonProcessor.cs
r18047 r18050 11 11 using HeuristicLab.Problems.DataAnalysis.Symbolic.Regression; 12 12 using HEAL.Attic; 13 using HeuristicLab.Data; 13 14 14 15 namespace HeuristicLab.JsonInterface { 15 16 [StorableType("844F2887-B7A0-4BD4-89B8-F9155C65D214")] 16 public class SymRegPythonP ostProcessor : Item, IResultCollectionPostProcessor {17 public class SymRegPythonProcessor : ParameterizedNamedItem, IResultCollectionProcessor { 17 18 19 #region Constructors & Cloning 18 20 [StorableConstructor] 19 protected SymRegPythonPostProcessor(StorableConstructorFlag _) : base(_) { 21 protected SymRegPythonProcessor(StorableConstructorFlag _) : base(_) { } 22 public SymRegPythonProcessor() { } 23 public SymRegPythonProcessor(SymRegPythonProcessor original, Cloner cloner) : base(original, cloner) { } 24 25 public override IDeepCloneable Clone(Cloner cloner) { 26 return new SymRegPythonProcessor(this, cloner); 20 27 } 28 #endregion 21 29 22 public SymRegPythonPostProcessor() { } 23 public SymRegPythonPostProcessor(SymRegPythonPostProcessor old, Cloner cloner) { } 24 25 public void Apply(IObservableDictionary<string, IItem> results, IDictionary<string, string> output) { 30 public void Apply(IObservableDictionary<string, IItem> results) { 26 31 var formatter = new SymbolicDataAnalysisExpressionPythonFormatter(); 27 foreach (var kvp in results) { 32 var resultCopy = new ObservableDictionary<string, IItem>(results); 33 foreach (var kvp in resultCopy) { 28 34 if (kvp.Value is ISymbolicRegressionSolution sol) { 29 output.Add(kvp.Key, formatter.Format(sol.Model.SymbolicExpressionTree));35 results.Add($"{kvp.Key} - Python" , new StringValue(formatter.Format(sol.Model.SymbolicExpressionTree))); 30 36 } 31 37 } 32 38 } 33 34 public override IDeepCloneable Clone(Cloner cloner) {35 return new SymRegPythonPostProcessor(this, cloner);36 }37 39 } 38 40 }
Note: See TracChangeset
for help on using the changeset viewer.