Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/06/21 16:16:20 (3 years ago)
Author:
mkommend
Message:

#3125: Added error handling to ECC View and minor code improvements.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views/3.4/SymbolicRegressionSolutionErrorCharacteristicsCurveView.cs

    r17180 r17976  
    2626using HeuristicLab.Algorithms.DataAnalysis;
    2727using HeuristicLab.MainForm;
     28using HeuristicLab.PluginInfrastructure;
    2829using HeuristicLab.Problems.DataAnalysis.Views;
    2930
     
    4344    private IRegressionSolution CreateLinearRegressionSolution() {
    4445      if (Content == null) throw new InvalidOperationException();
    45       double rmse, cvRmsError;
    4646      var problemData = (IRegressionProblemData)ProblemData.Clone();
    4747      if (!problemData.TrainingIndices.Any()) return null; // don't create an LR model if the problem does not have a training set (e.g. loaded into an existing model)
     
    8787      newProblemData.TestPartition.End = problemData.TestPartition.End;
    8888
    89       var solution = LinearRegression.CreateLinearRegressionSolution(newProblemData, out rmse, out cvRmsError);
    90       solution.Name = "Baseline (linear subset)";
    91       return solution;
     89      try {
     90        var solution = LinearRegression.CreateSolution(newProblemData, out _, out _);
     91        solution.Name = "Baseline (linear subset)";
     92        return solution;
     93      } catch (NotSupportedException e) {
     94        ErrorHandling.ShowErrorDialog("Could not create a linear regression solution.", e);
     95      } catch (ArgumentException e) {
     96        ErrorHandling.ShowErrorDialog("Could not create a linear regression solution.", e);
     97      }
     98      return null;
    9299    }
    93100
     
    99106      if (Content.Model.SymbolicExpressionTree.IterateNodesPrefix().OfType<LaggedVariableTreeNode>().Any()) yield break;
    100107
    101       yield return CreateLinearRegressionSolution();
     108      var linearRegressionSolution = CreateLinearRegressionSolution();
     109      if (linearRegressionSolution != null) yield return linearRegressionSolution;
    102110    }
    103111  }
Note: See TracChangeset for help on using the changeset viewer.