Changeset 18021


Ignore:
Timestamp:
07/17/21 19:03:41 (2 weeks ago)
Author:
gkronber
Message:

#3115: merged r17920,r17938,r17939 from trunk to stable

Location:
stable
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Problems.DataAnalysis.Views

  • stable/HeuristicLab.Problems.DataAnalysis.Views/3.4

  • stable/HeuristicLab.Problems.DataAnalysis.Views/3.4/Controls/FactorPartialDependencePlot.cs

    r17181 r18021  
    222222        if (updateOnFinish)
    223223          Update();
    224       } catch (OperationCanceledException) { 
     224      } catch (OperationCanceledException) {
    225225      } catch (AggregateException ae) {
    226226        if (!ae.InnerExceptions.Any(e => e is OperationCanceledException))
     
    434434      var refSolution = solutions.First();
    435435      var refSolVars = refSolution.ProblemData.Dataset.VariableNames;
     436      var refFactorVars = refSolution.ProblemData.Dataset.StringVariables;
     437      var distinctVals = refFactorVars.ToDictionary(fv => fv, fv => refSolution.ProblemData.Dataset.GetStringValues(fv).Distinct().ToArray());
     438
    436439      foreach (var solution in solutions.Skip(1)) {
    437         var variables1 = solution.ProblemData.Dataset.VariableNames;
    438         if (!variables1.All(refSolVars.Contains))
     440        var variables1 = new HashSet<string>(solution.ProblemData.Dataset.VariableNames);
     441        if (!variables1.IsSubsetOf(refSolVars))
    439442          return false;
    440443
    441         foreach (var factorVar in variables1.Where(solution.ProblemData.Dataset.VariableHasType<string>)) {
    442           var distinctVals = refSolution.ProblemData.Dataset.GetStringValues(factorVar).Distinct();
    443           if (solution.ProblemData.Dataset.GetStringValues(factorVar).Any(val => !distinctVals.Contains(val))) return false;
     444        foreach (var factorVar in solution.ProblemData.Dataset.StringVariables) {
     445          var refValues = distinctVals[factorVar];
     446          var values = new HashSet<string>(solution.ProblemData.Dataset.GetStringValues(factorVar));
     447
     448          if (!values.IsSubsetOf(refValues))
     449            return false;
    444450        }
    445451      }
  • stable/HeuristicLab.Problems.DataAnalysis.Views/3.4/Controls/PartialDependencePlot.cs

    r17803 r18021  
    530530
    531531    public async Task AddSolutionAsync(IRegressionSolution solution) {
     532      if (solutions.Contains(solution))
     533        return;
    532534      if (!SolutionsCompatible(solutions.Concat(new[] { solution })))
    533535        throw new ArgumentException("The solution is not compatible with the problem data.");
    534       if (solutions.Contains(solution))
    535         return;
    536536
    537537      solutions.Add(solution);
     
    568568      var refSolution = solutions.First();
    569569      var refSolVars = refSolution.ProblemData.Dataset.VariableNames;
     570      var refFactorVars = refSolution.ProblemData.Dataset.StringVariables;
     571      var distinctVals = refFactorVars.ToDictionary(fv => fv, fv => refSolution.ProblemData.Dataset.GetStringValues(fv).Distinct().ToArray());
     572
    570573      foreach (var solution in solutions.Skip(1)) {
    571         var variables1 = solution.ProblemData.Dataset.VariableNames;
    572         if (!variables1.All(refSolVars.Contains))
     574        var variables1 = new HashSet<string>(solution.ProblemData.Dataset.VariableNames);
     575        if (!variables1.IsSubsetOf(refSolVars))
    573576          return false;
    574577
    575         foreach (var factorVar in variables1.Where(solution.ProblemData.Dataset.VariableHasType<string>)) {
    576           var distinctVals = refSolution.ProblemData.Dataset.GetStringValues(factorVar).Distinct();
    577           if (solution.ProblemData.Dataset.GetStringValues(factorVar).Any(val => !distinctVals.Contains(val))) return false;
     578        foreach (var factorVar in solution.ProblemData.Dataset.StringVariables) {
     579          var refValues = distinctVals[factorVar];
     580          var values = new HashSet<string>(solution.ProblemData.Dataset.GetStringValues(factorVar));
     581
     582          if (!values.IsSubsetOf(refValues))
     583            return false;
    578584        }
    579585      }
  • stable/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionPartialDependencePlotView.cs

    r17181 r18021  
    119119
    120120      // create dataset of problemData input variables and model input variables
    121       // necessary workaround to have the variables in the occuring order
     121      // necessary workaround to have the variables in the occurring order
    122122      var inputvariables =
    123123        new HashSet<string>(Content.ProblemData.AllowedInputVariables.Union(Content.Model.VariablesUsedForPrediction));
Note: See TracChangeset for help on using the changeset viewer.