Changeset 16627


Ignore:
Timestamp:
02/28/19 12:40:15 (3 months ago)
Author:
gkronber
Message:

#2971: fixed update of interval results when solution changes (e.g. in the simplifier)

Location:
branches/2971_named_intervals
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionSolution.cs

    r16589 r16627  
    2929using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    3030using HeuristicLab.Problems.DataAnalysis.Implementation;
     31using HEAL.Attic;
    3132
    3233namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression {
     
    3435  /// Represents a symbolic regression solution (model + data) and attributes of the solution like accuracy and complexity
    3536  /// </summary>
    36   [StorableClass]
     37  [StorableType("CC27F20C-5925-406B-9C38-3C4B2B781C9F")]
    3738  [Item(Name = "SymbolicRegressionSolution", Description = "Represents a symbolic regression solution (model + data) and attributes of the solution like accuracy and complexity.")]
    3839  public sealed class SymbolicRegressionSolution : RegressionSolution, ISymbolicRegressionSolution {
     
    101102    }
    102103
    103     private NamedIntervals IntervalEvaluaitonCollection =>
    104       (NamedIntervals) this[IntervalEvaluationResultName].Value;
     104
     105    public NamedIntervals IntervalEvaluationCollection {
     106      get { return (NamedIntervals)this[IntervalEvaluationResultName].Value; }
     107      private set { this[IntervalEvaluationResultName].Value = value; }
     108    }
    105109
    106110
    107111
    108112    [StorableConstructor]
    109     private SymbolicRegressionSolution(bool deserializing) : base(deserializing) { }
     113    private SymbolicRegressionSolution(StorableConstructorFlag _) : base(_) { }
    110114    private SymbolicRegressionSolution(SymbolicRegressionSolution original, Cloner cloner)
    111115      : base(original, cloner) {
     
    130134      RecalculateResults();
    131135
    132       var namedIntervalCollection = new NamedIntervals();
    133       Add(new Result(IntervalEvaluationResultName, "Results concerning the derivation of symbolic regression solution", namedIntervalCollection));
    134       GetIntervalEvaulations(namedIntervalCollection);
     136      Add(new Result(IntervalEvaluationResultName, "Results concerning the derivation of symbolic regression solution", GetIntervalEvaluations()));
     137      ;
    135138    }
    136139
     
    152155        Add(new Result(EstimationLimitsResultsResultName, "Results concerning the estimation limits of symbolic regression solution", estimationLimitResults));
    153156        CalculateResults();
    154 
    155         var namedIntervalCollection = new NamedIntervals();
    156         Add(new Result(IntervalEvaluationResultName, "Results concerning the derivation of symbolic regression solution", namedIntervalCollection));
    157         GetIntervalEvaulations(namedIntervalCollection);
    158157      }
    159158    }
     
    164163    }
    165164
    166     private void GetIntervalEvaulations(NamedIntervals intervalEvaluation) {
     165    private NamedIntervals GetIntervalEvaluations() {
     166      var intervalEvaluation = new NamedIntervals();
    167167      var interpreter = new IntervalInterpreter();
    168168      var variableRanges = (ProblemData as RegressionProblemData)?.VariableRangesParameter.Value.VariableIntervals;
     
    181181        }
    182182      }
     183      return intervalEvaluation;
    183184    }
    184185   
     
    196197      TrainingNaNEvaluations = Model.Interpreter.GetSymbolicExpressionTreeValues(Model.SymbolicExpressionTree, ProblemData.Dataset, ProblemData.TrainingIndices).Count(double.IsNaN);
    197198      TestNaNEvaluations = Model.Interpreter.GetSymbolicExpressionTreeValues(Model.SymbolicExpressionTree, ProblemData.Dataset, ProblemData.TestIndices).Count(double.IsNaN);
     199
     200      IntervalEvaluationCollection = GetIntervalEvaluations();
    198201    }
    199202  }
  • branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/NamedIntervalsView.cs

    r16586 r16627  
    4747    public NamedIntervalsView() {
    4848      InitializeComponent();
    49       setColumnNames();
    5049      dataGridView.AutoGenerateColumns = false;
    5150      dataGridView.AllowUserToAddRows = false;
     
    6968
    7069    protected void UpdateData() {
     70      DataGridView.Rows.Clear();
     71      DataGridView.Columns.Clear();
     72      SetColumnNames();
     73
     74
    7175      var variablesCount = Content.VariableIntervals.Count;
    7276
     
    102106    }
    103107
    104     protected void setColumnNames() {
     108    protected void SetColumnNames() {
    105109      dataGridView.Columns.Add("lowerBound", "Lower Bound");
    106110      dataGridView.Columns.Add("upperBound", "Upper Bound");
Note: See TracChangeset for help on using the changeset viewer.