Changeset 15973 for branches/2522_RefactorPluginInfrastructure/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views/3.4/InteractiveSymbolicClassificationSolutionSimplifierViewBase.cs
- Timestamp:
- 06/28/18 11:13:37 (6 years ago)
- Location:
- branches/2522_RefactorPluginInfrastructure
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2522_RefactorPluginInfrastructure
- Property svn:ignore
-
old new 24 24 protoc.exe 25 25 obj 26 .vs
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
branches/2522_RefactorPluginInfrastructure/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views
- Property svn:mergeinfo changed
-
branches/2522_RefactorPluginInfrastructure/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views/3.4/InteractiveSymbolicClassificationSolutionSimplifierViewBase.cs
r12720 r15973 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 20 20 #endregion 21 21 22 using System;23 using System.Collections.Generic;24 using System.Linq;25 22 using HeuristicLab.Common; 26 23 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; … … 29 26 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views { 30 27 public abstract partial class InteractiveSymbolicClassificationSolutionSimplifierViewBase : InteractiveSymbolicDataAnalysisSolutionSimplifierView { 31 private readonly SymbolicClassificationSolutionImpactValuesCalculator calculator;32 33 28 public new ISymbolicClassificationSolution Content { 34 29 get { return (ISymbolicClassificationSolution)base.Content; } … … 36 31 } 37 32 38 p ublicInteractiveSymbolicClassificationSolutionSimplifierViewBase()39 : base( ) {33 protected InteractiveSymbolicClassificationSolutionSimplifierViewBase() 34 : base(new SymbolicClassificationSolutionImpactValuesCalculator()) { 40 35 InitializeComponent(); 41 36 this.Caption = "Interactive Classification Solution Simplifier"; 42 43 calculator = new SymbolicClassificationSolutionImpactValuesCalculator();44 37 } 45 38 … … 59 52 return model; 60 53 } 61 protected override Dictionary<ISymbolicExpressionTreeNode, double> CalculateReplacementValues(ISymbolicExpressionTree tree) {62 return tree.Root.GetSubtree(0).GetSubtree(0).IterateNodesPrefix().ToDictionary(63 n => n,64 n => calculator.CalculateReplacementValue(Content.Model, n, Content.ProblemData, Content.ProblemData.TrainingIndices)65 );66 }67 68 protected override Dictionary<ISymbolicExpressionTreeNode, double> CalculateImpactValues(ISymbolicExpressionTree tree) {69 var values = CalculateImpactAndReplacementValues(tree);70 return values.ToDictionary(x => x.Key, x => x.Value.Item1);71 }72 73 protected override Dictionary<ISymbolicExpressionTreeNode, Tuple<double, double>> CalculateImpactAndReplacementValues(ISymbolicExpressionTree tree) {74 var impactAndReplacementValues = new Dictionary<ISymbolicExpressionTreeNode, Tuple<double, double>>();75 foreach (var node in tree.Root.GetSubtree(0).GetSubtree(0).IterateNodesPrefix()) {76 double impactValue, replacementValue, newQualityForImpactsCalculation;77 calculator.CalculateImpactAndReplacementValues(Content.Model, node, Content.ProblemData, Content.ProblemData.TrainingIndices, out impactValue, out replacementValue, out newQualityForImpactsCalculation);78 impactAndReplacementValues.Add(node, new Tuple<double, double>(impactValue, replacementValue));79 }80 return impactAndReplacementValues;81 }82 83 protected override void btnOptimizeConstants_Click(object sender, EventArgs e) {84 85 }86 54 } 87 55 }
Note: See TracChangeset
for help on using the changeset viewer.