Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/13/21 10:55:09 (3 years ago)
Author:
gkronber
Message:

#3087: merged r17784:18004 from trunk to branch to prepare for trunk reintegration (fixed a conflict in CrossValidation.cs)

Location:
branches/3087_Ceres_Integration
Files:
2 deleted
9 edited
9 copied

Legend:

Unmodified
Added
Removed
  • branches/3087_Ceres_Integration

  • branches/3087_Ceres_Integration/HeuristicLab.Problems.DataAnalysis.Views

  • branches/3087_Ceres_Integration/HeuristicLab.Problems.DataAnalysis.Views/3.4/Controls/FactorPartialDependencePlot.cs

    r17180 r18006  
    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      }
  • branches/3087_Ceres_Integration/HeuristicLab.Problems.DataAnalysis.Views/3.4/Controls/PartialDependencePlot.cs

    r17775 r18006  
    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      }
  • branches/3087_Ceres_Integration/HeuristicLab.Problems.DataAnalysis.Views/3.4/HeuristicLab.Problems.DataAnalysis.Views-3.4.csproj

    r17579 r18006  
    9999  </PropertyGroup>
    100100  <ItemGroup>
    101     <Reference Include="ALGLIB-3.7.0, Version=3.7.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
    102       <HintPath>..\..\bin\ALGLIB-3.7.0.dll</HintPath>
    103       <Private>False</Private>
     101    <Reference Include="ALGLIB-3.17.0, Version=3.17.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     102      <SpecificVersion>False</SpecificVersion>
     103      <HintPath>..\..\bin\ALGLIB-3.17.0.dll</HintPath>
     104      <Private>False</Private>
     105    </Reference>
     106    <Reference Include="HEAL.Attic, Version=1.5.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     107      <SpecificVersion>False</SpecificVersion>
     108      <HintPath>..\..\bin\HEAL.Attic.dll</HintPath>
    104109    </Reference>
    105110    <Reference Include="System" />
     
    221226    <Compile Include="Interfaces\IDataPreprocessorStarter.cs" />
    222227    <Compile Include="Interfaces\IPartialDependencePlot.cs" />
    223     <Compile Include="IntervalCollectionView.cs">
    224       <SubType>UserControl</SubType>
    225     </Compile>
    226     <Compile Include="IntervalCollectionView.Designer.cs">
    227       <DependentUpon>IntervalCollectionView.cs</DependentUpon>
    228     </Compile>
    229228    <Compile Include="MenuItems\ChangeDataOfOptimizersMenuItem.cs" />
    230229    <Compile Include="MenuItems\ShrinkDataAnalysisRunsMenuItem.cs" />
     
    242241      <DependentUpon>ProblemDataView.cs</DependentUpon>
    243242    </Compile>
     243    <Compile Include="Properties\Resources.Designer.cs">
     244      <AutoGen>True</AutoGen>
     245      <DesignTime>True</DesignTime>
     246      <DependentUpon>Resources.resx</DependentUpon>
     247    </Compile>
    244248    <Compile Include="Regression\ConfidenceRegressionSolutionEstimatedValuesView.cs">
    245249      <SubType>UserControl</SubType>
     
    254258      <DependentUpon>ConfidenceRegressionSolutionLineChartView.cs</DependentUpon>
    255259    </Compile>
     260    <Compile Include="Regression\IntervalCollectionView.cs">
     261      <SubType>UserControl</SubType>
     262    </Compile>
     263    <Compile Include="Regression\IntervalCollectionView.Designer.cs">
     264      <DependentUpon>IntervalCollectionView.cs</DependentUpon>
     265    </Compile>
    256266    <Compile Include="Regression\RegressionEnsembleSolutionModelWeightsView.cs">
    257267      <SubType>UserControl</SubType>
     
    343353    <Compile Include="Regression\RegressionSolutionScatterPlotView.Designer.cs">
    344354      <DependentUpon>RegressionSolutionScatterPlotView.cs</DependentUpon>
     355    </Compile>
     356    <Compile Include="Regression\ShapeConstraintsView.cs">
     357      <SubType>UserControl</SubType>
     358    </Compile>
     359    <Compile Include="Regression\ShapeConstraintsView.Designer.cs">
     360      <DependentUpon>ShapeConstraintsView.cs</DependentUpon>
     361    </Compile>
     362    <Compile Include="Regression\ShapeConstraintView.cs">
     363      <SubType>UserControl</SubType>
     364    </Compile>
     365    <Compile Include="Regression\ShapeConstraintView.Designer.cs">
     366      <DependentUpon>ShapeConstraintView.cs</DependentUpon>
    345367    </Compile>
    346368    <Compile Include="Solution Views\ClassificationSolutionView.cs">
     
    561583      <Project>{94186A6A-5176-4402-AE83-886557B53CCA}</Project>
    562584      <Name>HeuristicLab.PluginInfrastructure-3.3</Name>
    563       <Private>False</Private>
    564     </ProjectReference>
    565     <ProjectReference Include="..\..\HeuristicLab.Problems.DataAnalysis.Symbolic.Regression\3.4\HeuristicLab.Problems.DataAnalysis.Symbolic.Regression-3.4.csproj">
    566       <Project>{5AC82412-911B-4FA2-A013-EDC5E3F3FCC2}</Project>
    567       <Name>HeuristicLab.Problems.DataAnalysis.Symbolic.Regression-3.4</Name>
    568       <Private>False</Private>
    569     </ProjectReference>
    570     <ProjectReference Include="..\..\HeuristicLab.Problems.DataAnalysis.Symbolic\3.4\HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj">
    571       <Project>{3D28463F-EC96-4D82-AFEE-38BE91A0CA00}</Project>
    572       <Name>HeuristicLab.Problems.DataAnalysis.Symbolic-3.4</Name>
    573585      <Private>False</Private>
    574586    </ProjectReference>
     
    605617      <DependentUpon>AbstractFeatureCorrelationView.cs</DependentUpon>
    606618    </EmbeddedResource>
     619    <EmbeddedResource Include="Properties\Resources.resx">
     620      <Generator>ResXFileCodeGenerator</Generator>
     621      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
     622    </EmbeddedResource>
    607623  </ItemGroup>
    608624  <ItemGroup>
    609     <Reference Include="HEAL.Attic, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
    610       <SpecificVersion>False</SpecificVersion>
    611       <HintPath>..\..\bin\HEAL.Attic.dll</HintPath>
    612       <Private>False</Private>
    613     </Reference>
     625    <EmbeddedResource Include="Resources\shapeConstraintsHelp.rtf" />
     626    <None Include="Resources\VS2008ImageLibrary_Annotations_Information.png" />
    614627  </ItemGroup>
    615628  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  • branches/3087_Ceres_Integration/HeuristicLab.Problems.DataAnalysis.Views/3.4/Plugin.cs.frame

    r17184 r18006  
    2828  [Plugin("HeuristicLab.Problems.DataAnalysis.Views", "Provides views for base classes for data analysis tasks.", "3.4.12.$WCREV$")]
    2929  [PluginFile("HeuristicLab.Problems.DataAnalysis.Views-3.4.dll", PluginFileType.Assembly)]
    30   [PluginDependency("HeuristicLab.ALGLIB", "3.7.0")]
     30  [PluginDependency("HeuristicLab.ALGLIB", "3.17.0")]
    3131  [PluginDependency("HeuristicLab.Algorithms.DataAnalysis", "3.4")]
    3232  [PluginDependency("HeuristicLab.Analysis", "3.3")]
     
    4545  [PluginDependency("HeuristicLab.Optimizer", "3.3")]
    4646  [PluginDependency("HeuristicLab.Problems.DataAnalysis", "3.4")]
    47   [PluginDependency("HeuristicLab.Problems.DataAnalysis.Symbolic.Regression", "3.4")]
    4847  [PluginDependency("HeuristicLab.Visualization.ChartControlsExtensions", "3.3")]
    4948  public class HeuristicLabProblemsDataAnalysisViewsPlugin : PluginBase {
  • branches/3087_Ceres_Integration/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionErrorCharacteristicsCurveView.cs

    r17996 r18006  
    2929using HeuristicLab.MainForm;
    3030using HeuristicLab.Optimization;
     31using HeuristicLab.PluginInfrastructure;
    3132
    3233namespace HeuristicLab.Problems.DataAnalysis.Views {
     
    7475    }
    7576
    76     private readonly IList<IRegressionSolution> solutions = new List<IRegressionSolution>();
     77    private readonly List<IRegressionSolution> solutions = new List<IRegressionSolution>();
    7778    public IEnumerable<IRegressionSolution> Solutions {
    7879      get { return solutions.AsEnumerable(); }
     
    101102      else {
    102103        // recalculate baseline solutions (for symbolic regression models the features used in the model might have changed)
    103         solutions.Clear(); // remove all
     104        solutions.Clear();
    104105        solutions.Add(Content); // re-add the first solution
    105         // and recalculate all other solutions
    106         foreach (var sol in CreateBaselineSolutions()) {
    107           solutions.Add(sol);
    108         }
     106        var baselineSolutions = CreateBaselineSolutions();
     107        solutions.AddRange(baselineSolutions);
    109108        UpdateChart();
    110109      }
     
    114113      else {
    115114        // recalculate baseline solutions
    116         solutions.Clear(); // remove all
     115        solutions.Clear();
    117116        solutions.Add(Content); // re-add the first solution
    118         // and recalculate all other solutions
    119         foreach (var sol in CreateBaselineSolutions()) {
    120           solutions.Add(sol);
    121         }
     117        var baselineSolutions = CreateBaselineSolutions();
     118        solutions.AddRange(baselineSolutions);
    122119        UpdateChart();
    123120      }
     
    129126      ReadOnly = Content == null;
    130127      if (Content != null) {
    131         // recalculate all solutions
    132128        solutions.Add(Content);
    133         if (ProblemData.TrainingIndices.Any()) {
    134           foreach (var sol in CreateBaselineSolutions())
    135             solutions.Add(sol);
    136           // more solutions can be added by drag&drop
    137         }
     129        var baselineSolutions = CreateBaselineSolutions();
     130        solutions.AddRange(baselineSolutions);
    138131      }
    139132      UpdateChart();
     
    249242    protected virtual List<double> GetResiduals(IEnumerable<double> originalValues, IEnumerable<double> estimatedValues) {
    250243      switch (residualComboBox.SelectedItem.ToString()) {
    251         case "Absolute error": return originalValues.Zip(estimatedValues, (x, y) => Math.Abs(x - y))
     244        case "Absolute error":
     245          return originalValues.Zip(estimatedValues, (x, y) => Math.Abs(x - y))
    252246            .Where(r => !double.IsNaN(r) && !double.IsInfinity(r)).ToList();
    253         case "Squared error": return originalValues.Zip(estimatedValues, (x, y) => (x - y) * (x - y))
     247        case "Squared error":
     248          return originalValues.Zip(estimatedValues, (x, y) => (x - y) * (x - y))
    254249            .Where(r => !double.IsNaN(r) && !double.IsInfinity(r)).ToList();
    255250        case "Relative error":
     
    289284
    290285    protected virtual IEnumerable<IRegressionSolution> CreateBaselineSolutions() {
    291       yield return CreateConstantSolution();
    292       yield return CreateLinearSolution();
     286      var constantSolution = CreateConstantSolution();
     287      if (constantSolution != null) yield return CreateConstantSolution();
     288
     289      var linearRegressionSolution = CreateLinearSolution();
     290      if (linearRegressionSolution != null) yield return CreateLinearSolution();
    293291    }
    294292
    295293    private IRegressionSolution CreateConstantSolution() {
     294      if (!ProblemData.TrainingIndices.Any()) return null;
     295
    296296      double averageTrainingTarget = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TrainingIndices).Average();
    297297      var model = new ConstantModel(averageTrainingTarget, ProblemData.TargetVariable);
     
    301301    }
    302302    private IRegressionSolution CreateLinearSolution() {
    303       double rmsError, cvRmsError;
    304       var solution = LinearRegression.CreateLinearRegressionSolution((IRegressionProblemData)ProblemData.Clone(), out rmsError, out cvRmsError);
    305       solution.Name = "Baseline (linear)";
    306       return solution;
     303      try {
     304        var solution = LinearRegression.CreateSolution((IRegressionProblemData)ProblemData.Clone(), out _, out _);
     305        solution.Name = "Baseline (linear)";
     306        return solution;
     307      } catch (NotSupportedException e) {
     308        ErrorHandling.ShowErrorDialog("Could not create a linear regression solution.", e);
     309      } catch (ArgumentException e) {
     310        ErrorHandling.ShowErrorDialog("Could not create a linear regression solution.", e);
     311      }
     312      return null;
    307313    }
    308314
  • branches/3087_Ceres_Integration/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionLineChartViewBase.cs

    r17180 r18006  
    8181        this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].LegendText = ESTIMATEDVALUES_TRAINING_SERIES_NAME;
    8282        this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].ChartType = SeriesChartType.FastLine;
    83         this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].EmptyPointStyle.Color = this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].Color;
    8483        int[] trainingIdx;
    8584        double[] trainingY;
     
    120119        double min = double.MaxValue, max = double.MinValue;
    121120        foreach (var point in chart.Series.SelectMany(x => x.Points)) {
    122           if (!point.YValues.Any() || double.IsInfinity(point.YValues[0]) || double.IsNaN(point.YValues[0]))
     121          if (point.IsEmpty || !point.YValues.Any() || double.IsInfinity(point.YValues[0]) || double.IsNaN(point.YValues[0]))
    123122            continue;
    124123          var y = point.YValues[0];
  • branches/3087_Ceres_Integration/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionPartialDependencePlotView.cs

    r17180 r18006  
    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.