Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/16/13 13:13:41 (11 years ago)
Author:
spimming
Message:

#1888:

  • Merged revisions from trunk
Location:
branches/OaaS
Files:
21 edited
18 copied

Legend:

Unmodified
Added
Removed
  • branches/OaaS

  • branches/OaaS/HeuristicLab.Problems.DataAnalysis.Views

  • branches/OaaS/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationEnsembleSolutionEstimatedClassValuesView.cs

    r8139 r9363  
    9696      }
    9797
    98       int classValuesCount = Content.ProblemData.ClassValues.Count;
     98      int classValuesCount = Content.ProblemData.Classes;
    9999      int solutionsCount = Content.ClassificationSolutions.Count();
    100100      string[,] values = new string[indices.Length, 5 + classValuesCount + solutionsCount];
     
    106106        int row = indices[i];
    107107        values[i, 0] = row.ToString();
    108         values[i, 1] = target[i].ToString();
     108        values[i, 1] = target[row].ToString();
    109109        //display only indices and target values if no models are present
    110110        if (solutionsCount > 0) {
    111111          values[i, 2] = estimatedClassValues[i].ToString();
    112           values[i, 3] = (target[i].IsAlmost(estimatedClassValues[i])).ToString();
     112          values[i, 3] = (target[row].IsAlmost(estimatedClassValues[i])).ToString();
    113113          var groups =
    114114            estimatedValuesVector[i].GroupBy(x => x).Select(g => new { Key = g.Key, Count = g.Count() }).ToList();
    115115          var estimationCount = groups.Where(g => g.Key != null).Select(g => g.Count).Sum();
    116           values[i, 4] =
    117             (((double)groups.Where(g => g.Key == estimatedClassValues[i]).Single().Count) / estimationCount).ToString();
    118           for (int classIndex = 0; classIndex < Content.ProblemData.ClassValues.Count; classIndex++) {
    119             var group = groups.Where(g => g.Key == Content.ProblemData.ClassValues[classIndex]).SingleOrDefault();
     116          // take care of divide by zero
     117          if (estimationCount != 0) {
     118            values[i, 4] = (((double)groups.Where(g => g.Key == estimatedClassValues[i]).Single().Count) / estimationCount).ToString();
     119          } else {
     120            values[i, 4] = double.NaN.ToString();
     121          }
     122          for (int classIndex = 0; classIndex < Content.ProblemData.Classes; classIndex++) {
     123            var group = groups.Where(g => g.Key == Content.ProblemData.ClassValues.ElementAt(classIndex)).SingleOrDefault();
    120124            if (group == null) values[i, 5 + classIndex] = 0.ToString();
    121125            else values[i, 5 + classIndex] = group.Count.ToString();
  • branches/OaaS/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationEnsembleSolutionModelView.cs

    r7259 r9363  
    2020#endregion
    2121
     22using System;
    2223using System.Linq;
    2324using System.Windows.Forms;
    2425using HeuristicLab.Common;
     26using HeuristicLab.Core;
    2527using HeuristicLab.Core.Views;
    2628using HeuristicLab.MainForm;
     
    8385            solutions = solutions.Select(s => cloner.Clone(s));
    8486          }
    85           foreach (var solution in solutions)
    86             Content.Add(solution);
     87          var solutionCollection = Content as ItemCollection<IClassificationSolution>;
     88          if (solutionCollection != null) {
     89            solutionCollection.AddRange(solutions);
     90          } else {
     91            foreach (var solution in solutions)
     92              Content.Add(solution);
     93          }
     94        }
     95      }
     96      protected override void itemsListView_KeyDown(object sender, KeyEventArgs e) {
     97        var solutionCollection = Content as ItemCollection<IClassificationSolution>;
     98        if (e.KeyCode == Keys.Delete && solutionCollection != null) {
     99          if ((itemsListView.SelectedItems.Count > 0) && !Content.IsReadOnly && !ReadOnly) {
     100            solutionCollection.RemoveRange(itemsListView.SelectedItems.Cast<ListViewItem>().Select(x => (IClassificationSolution)x.Tag));
     101          }
     102        } else {
     103          base.itemsListView_KeyDown(sender, e);
     104        }
     105      }
     106      protected override void removeButton_Click(object sender, EventArgs e) {
     107        var solutionCollection = Content as ItemCollection<IClassificationSolution>;
     108        if (itemsListView.SelectedItems.Count > 0 && solutionCollection != null) {
     109          solutionCollection.RemoveRange(itemsListView.SelectedItems.Cast<ListViewItem>().Select(x => (IClassificationSolution)x.Tag));
     110          itemsListView.SelectedItems.Clear();
     111        } else {
     112          base.removeButton_Click(sender, e);
    87113        }
    88114      }
  • branches/OaaS/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationSolutionConfusionMatrixView.Designer.cs

    r7967 r9363  
    1 namespace HeuristicLab.Problems.DataAnalysis.Views {
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
     22namespace HeuristicLab.Problems.DataAnalysis.Views {
    223  partial class ClassificationSolutionConfusionMatrixView {
    324    /// <summary>
  • branches/OaaS/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/DiscriminantFunctionClassificationRocCurvesView.Designer.cs

    r7967 r9363  
    1 namespace HeuristicLab.Problems.DataAnalysis.Views {
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
     22namespace HeuristicLab.Problems.DataAnalysis.Views {
    223  partial class DiscriminantFunctionClassificationRocCurvesView {
    324    /// <summary>
  • branches/OaaS/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/DiscriminantFunctionClassificationRocCurvesView.cs

    r8139 r9363  
    114114        maxThreshold += thresholdIncrement;
    115115
    116         List<double> classValues = Content.ProblemData.ClassValues.OrderBy(x => x).ToList();
     116        List<double> classValues = Content.ProblemData.ClassValues.ToList();
    117117
    118118        foreach (double classValue in classValues) {
  • branches/OaaS/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/DiscriminantFunctionClassificationSolutionThresholdView.Designer.cs

    r7967 r9363  
    1 namespace HeuristicLab.Problems.DataAnalysis.Views {
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
     22namespace HeuristicLab.Problems.DataAnalysis.Views {
    223  partial class DiscriminantFunctionClassificationSolutionThresholdView {
    324    /// <summary>
     
    92113
    93114    }
    94 
    95115    #endregion
    96116
  • branches/OaaS/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/DiscriminantFunctionClassificationSolutionThresholdView.cs

    r8139 r9363  
    6565
    6666      this.chart.ChartAreas[0].AxisY.Title = "Estimated Values";
     67      this.chart.ChartAreas[0].AxisY.IsStartedFromZero = false;
    6768      this.chart.ChartAreas[0].CursorY.IsUserSelectionEnabled = true;
    6869      this.chart.ChartAreas[0].AxisX.ScaleView.Zoomable = true;
     
    169170      chart.Annotations.Clear();
    170171      int classIndex = 1;
     172      IClassificationProblemData problemData = Content.ProblemData;
     173      var classValues = Content.Model.ClassValues.ToArray();
     174      Axis y = chart.ChartAreas[0].AxisY;
     175      Axis x = chart.ChartAreas[0].AxisX;
     176      string name;
    171177      foreach (double threshold in Content.Model.Thresholds) {
    172178        if (!double.IsInfinity(threshold)) {
     
    176182          annotation.LineWidth = 2;
    177183          annotation.LineColor = Color.Red;
    178 
    179184          annotation.IsInfinitive = true;
    180185          annotation.ClipToChartArea = chart.ChartAreas[0].Name;
    181186          annotation.Tag = classIndex;  //save classIndex as Tag to avoid moving the threshold accross class bounderies
    182 
    183187          annotation.AxisX = chart.ChartAreas[0].AxisX;
    184           annotation.AxisY = chart.ChartAreas[0].AxisY;
     188          annotation.AxisY = y;
    185189          annotation.Y = threshold;
    186190
     191          name = problemData.GetClassName(classValues[classIndex - 1]);
     192          TextAnnotation beneathLeft = CreateTextAnnotation(name, classIndex, x, y, x.Minimum, threshold, ContentAlignment.TopLeft);
     193          TextAnnotation beneathRight = CreateTextAnnotation(name, classIndex, x, y, x.Maximum, threshold, ContentAlignment.TopRight);
     194
     195          name = problemData.GetClassName(classValues[classIndex]);
     196          TextAnnotation aboveLeft = CreateTextAnnotation(name, classIndex, x, y, x.Minimum, threshold, ContentAlignment.BottomLeft);
     197          TextAnnotation aboveRight = CreateTextAnnotation(name, classIndex, x, y, x.Maximum, threshold, ContentAlignment.BottomRight);
     198
    187199          chart.Annotations.Add(annotation);
     200          chart.Annotations.Add(beneathLeft);
     201          chart.Annotations.Add(aboveLeft);
     202          chart.Annotations.Add(beneathRight);
     203          chart.Annotations.Add(aboveRight);
     204
     205          beneathLeft.ResizeToContent();
     206          beneathRight.ResizeToContent();
     207          aboveLeft.ResizeToContent();
     208          aboveRight.ResizeToContent();
     209
     210          beneathRight.Width = -beneathRight.Width;
     211          aboveLeft.Height = -aboveLeft.Height;
     212          aboveRight.Height = -aboveRight.Height;
     213          aboveRight.Width = -aboveRight.Width;
     214
    188215          classIndex++;
    189216        }
    190217      }
     218    }
     219
     220    private TextAnnotation CreateTextAnnotation(string name, int classIndex, Axis axisX, Axis axisY, double x, double y, ContentAlignment alignment) {
     221      TextAnnotation annotation = new TextAnnotation();
     222      annotation.Text = name;
     223      annotation.AllowMoving = true;
     224      annotation.AllowResizing = false;
     225      annotation.AllowSelecting = false;
     226      annotation.IsSizeAlwaysRelative = true;
     227      annotation.ClipToChartArea = chart.ChartAreas[0].Name;
     228      annotation.Tag = classIndex;
     229      annotation.AxisX = axisX;
     230      annotation.AxisY = axisY;
     231      annotation.Alignment = alignment;
     232      annotation.X = x;
     233      annotation.Y = y;
     234      return annotation;
    191235    }
    192236
     
    238282      double[] thresholds = Content.Model.Thresholds.ToArray();
    239283      thresholds[classIndex] = e.NewLocationY;
     284      Array.Sort(thresholds);
    240285      Content.Model.SetThresholdsAndClassValues(thresholds, Content.Model.ClassValues);
    241286    }
  • branches/OaaS/HeuristicLab.Problems.DataAnalysis.Views/3.4/HeuristicLab.Problems.DataAnalysis.Views-3.4.csproj

    r7823 r9363  
    9393  </PropertyGroup>
    9494  <ItemGroup>
     95    <Reference Include="ALGLIB-3.7.0, Version=3.7.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     96      <HintPath>..\..\bin\ALGLIB-3.7.0.dll</HintPath>
     97      <Private>False</Private>
     98    </Reference>
    9599    <Reference Include="System" />
    96100    <Reference Include="System.Core">
     
    122126      <DependentUpon>ClassificationEnsembleSolutionModelView.cs</DependentUpon>
    123127    </Compile>
     128    <Compile Include="Classification\ClassificationFeatureCorrelationView.cs">
     129      <SubType>UserControl</SubType>
     130    </Compile>
     131    <Compile Include="Classification\ClassificationFeatureCorrelationView.Designer.cs">
     132      <DependentUpon>ClassificationFeatureCorrelationView.cs</DependentUpon>
     133    </Compile>
     134    <Compile Include="Classification\ClassificationTimeframeFeatureCorrelationView.cs">
     135      <SubType>UserControl</SubType>
     136    </Compile>
     137    <Compile Include="Classification\ClassificationTimeframeFeatureCorrelationView.Designer.cs">
     138      <DependentUpon>ClassificationTimeframeFeatureCorrelationView.cs</DependentUpon>
     139    </Compile>
     140    <Compile Include="Classification\DiscriminantFunctionClassificationModelView.cs">
     141      <SubType>UserControl</SubType>
     142    </Compile>
     143    <Compile Include="Classification\DiscriminantFunctionClassificationModelView.Designer.cs">
     144      <DependentUpon>DiscriminantFunctionClassificationModelView.cs</DependentUpon>
     145    </Compile>
     146    <Compile Include="Clustering\ClusteringSolutionVisualizationView.cs">
     147      <SubType>UserControl</SubType>
     148    </Compile>
     149    <Compile Include="Clustering\ClusteringSolutionVisualizationView.Designer.cs">
     150      <DependentUpon>ClusteringSolutionVisualizationView.cs</DependentUpon>
     151    </Compile>
     152    <Compile Include="FeatureCorrelation\AbstractFeatureCorrelationView.cs">
     153      <SubType>UserControl</SubType>
     154    </Compile>
     155    <Compile Include="FeatureCorrelation\AbstractFeatureCorrelationView.Designer.cs">
     156      <DependentUpon>AbstractFeatureCorrelationView.cs</DependentUpon>
     157    </Compile>
    124158    <Compile Include="DataAnalysisSolutionEvaluationView.cs">
    125159      <SubType>UserControl</SubType>
     
    128162      <DependentUpon>DataAnalysisSolutionEvaluationView.cs</DependentUpon>
    129163    </Compile>
     164    <Compile Include="FeatureCorrelation\EnhancedStringConvertibleMatrixView.cs">
     165      <SubType>UserControl</SubType>
     166    </Compile>
     167    <Compile Include="FeatureCorrelation\EnhancedStringConvertibleMatrixView.Designer.cs">
     168      <DependentUpon>EnhancedStringConvertibleMatrixView.cs</DependentUpon>
     169    </Compile>
     170    <Compile Include="FeatureCorrelation\FeatureCorrelationCalculator.cs" />
     171    <Compile Include="FeatureCorrelation\FeatureCorrelationView.cs">
     172      <SubType>UserControl</SubType>
     173    </Compile>
     174    <Compile Include="FeatureCorrelation\FeatureCorrelationView.Designer.cs">
     175      <DependentUpon>FeatureCorrelationView.cs</DependentUpon>
     176    </Compile>
    130177    <Compile Include="Plugin.cs" />
     178    <Compile Include="ProblemDataView.cs">
     179      <SubType>UserControl</SubType>
     180    </Compile>
     181    <Compile Include="ProblemDataView.Designer.cs">
     182      <DependentUpon>ProblemDataView.cs</DependentUpon>
     183    </Compile>
     184    <Compile Include="Regression\RegressionFeatureCorrelationView.cs">
     185      <SubType>UserControl</SubType>
     186    </Compile>
     187    <Compile Include="Regression\RegressionFeatureCorrelationView.Designer.cs">
     188      <DependentUpon>RegressionFeatureCorrelationView.cs</DependentUpon>
     189    </Compile>
     190    <Compile Include="Regression\RegressionTimeframeFeatureCorrelationView.cs">
     191      <SubType>UserControl</SubType>
     192    </Compile>
     193    <Compile Include="Regression\RegressionTimeframeFeatureCorrelationView.Designer.cs">
     194      <DependentUpon>RegressionTimeframeFeatureCorrelationView.cs</DependentUpon>
     195    </Compile>
    131196    <Compile Include="Regression\RegressionEnsembleSolutionModelView.cs">
    132197      <SubType>UserControl</SubType>
     
    256321    <Compile Include="Solution Views\RegressionSolutionView.Designer.cs">
    257322      <DependentUpon>RegressionSolutionView.cs</DependentUpon>
     323    </Compile>
     324    <Compile Include="FeatureCorrelation\TimeframeFeatureCorrelationView.cs">
     325      <SubType>UserControl</SubType>
     326    </Compile>
     327    <Compile Include="FeatureCorrelation\TimeframeFeatureCorrelationView.Designer.cs">
     328      <DependentUpon>TimeframeFeatureCorrelationView.cs</DependentUpon>
     329    </Compile>
     330    <Compile Include="Solution Views\TimeSeriesPrognosisSolutionView.cs">
     331      <SubType>UserControl</SubType>
     332    </Compile>
     333    <Compile Include="Solution Views\TimeSeriesPrognosisSolutionView.Designer.cs">
     334      <DependentUpon>TimeSeriesPrognosisSolutionView.cs</DependentUpon>
     335    </Compile>
     336    <Compile Include="TimeSeriesPrognosis\TimeSeriesPrognosisResultsView.cs">
     337      <SubType>UserControl</SubType>
     338    </Compile>
     339    <Compile Include="TimeSeriesPrognosis\TimeSeriesPrognosisResultsView.Designer.cs">
     340      <DependentUpon>TimeSeriesPrognosisResultsView.cs</DependentUpon>
     341    </Compile>
     342    <Compile Include="TimeSeriesPrognosis\TimeSeriesPrognosisSolutionErrorCharacteristicsCurveView.cs">
     343      <SubType>UserControl</SubType>
     344    </Compile>
     345    <Compile Include="TimeSeriesPrognosis\TimeSeriesPrognosisSolutionErrorCharacteristicsCurveView.Designer.cs">
     346      <DependentUpon>TimeSeriesPrognosisSolutionErrorCharacteristicsCurveView.cs</DependentUpon>
    258347    </Compile>
    259348    <None Include="HeuristicLab.snk" />
     
    263352  </ItemGroup>
    264353  <ItemGroup>
     354    <ProjectReference Include="..\..\HeuristicLab.Algorithms.DataAnalysis\3.4\HeuristicLab.Algorithms.DataAnalysis-3.4.csproj">
     355      <Project>{2E782078-FA81-4B70-B56F-74CE38DAC6C8}</Project>
     356      <Name>HeuristicLab.Algorithms.DataAnalysis-3.4</Name>
     357    </ProjectReference>
     358    <ProjectReference Include="..\..\HeuristicLab.Analysis.Views\3.3\HeuristicLab.Analysis.Views-3.3.csproj">
     359      <Project>{76945D76-CA61-4147-9DC2-0ACDCDDF87F9}</Project>
     360      <Name>HeuristicLab.Analysis.Views-3.3</Name>
     361      <Private>False</Private>
     362    </ProjectReference>
     363    <ProjectReference Include="..\..\HeuristicLab.Analysis\3.3\HeuristicLab.Analysis-3.3.csproj">
     364      <Project>{887425B4-4348-49ED-A457-B7D2C26DDBF9}</Project>
     365      <Name>HeuristicLab.Analysis-3.3</Name>
     366      <Private>False</Private>
     367    </ProjectReference>
    265368    <ProjectReference Include="..\..\HeuristicLab.Collections\3.3\HeuristicLab.Collections-3.3.csproj">
    266369      <Project>{958B43BC-CC5C-4FA2-8628-2B3B01D890B6}</Project>
     
    367470  </ItemGroup>
    368471  <ItemGroup>
    369     <Folder Include="obj\" />
     472    <EmbeddedResource Include="FeatureCorrelation\AbstractFeatureCorrelationView.resx">
     473      <DependentUpon>AbstractFeatureCorrelationView.cs</DependentUpon>
     474    </EmbeddedResource>
    370475  </ItemGroup>
    371476  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
     
    378483  -->
    379484  <PropertyGroup>
    380     <PreBuildEvent>set Path=%25Path%25;$(ProjectDir);$(SolutionDir)
     485    <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">set Path=%25Path%25;$(ProjectDir);$(SolutionDir)
    381486set ProjectDir=$(ProjectDir)
    382487set SolutionDir=$(SolutionDir)
     
    385490call PreBuildEvent.cmd
    386491</PreBuildEvent>
     492    <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
     493export ProjectDir=$(ProjectDir)
     494export SolutionDir=$(SolutionDir)
     495
     496$SolutionDir/PreBuildEvent.sh
     497</PreBuildEvent>
    387498  </PropertyGroup>
    388499</Project>
  • branches/OaaS/HeuristicLab.Problems.DataAnalysis.Views/3.4/MenuItems/CreateEnsembleMenuItem.cs

    r7738 r9363  
    2626using HeuristicLab.Core;
    2727using HeuristicLab.MainForm;
     28using HeuristicLab.MainForm.WindowsForms;
    2829using HeuristicLab.Optimization;
     30using HeuristicLab.Optimization.Views;
    2931using HeuristicLab.Optimizer;
    3032
     
    4951    protected override void OnActiveViewChanged(object sender, EventArgs e) {
    5052      IContentView activeView = MainFormManager.MainForm.ActiveView as IContentView;
    51       if ((activeView != null) && (activeView.Content != null) && (activeView.Content is IOptimizer) && !activeView.Locked) {
    52         var optimizer = activeView.Content as IOptimizer;
    53         ToolStripItem.Enabled = GetDataAnalysisResults(optimizer).Any();
    54       } else {
    55         ToolStripItem.Enabled = false;
    56       }
     53      ToolStripItem.Enabled = GetDataAnalysisResults(activeView).Any();
     54    }
     55    protected override void OnViewChanged(object sender, EventArgs e) {
     56      base.OnViewChanged(sender, e);
     57      IContentView activeView = MainFormManager.MainForm.ActiveView as IContentView;
     58      ToolStripItem.Enabled = GetDataAnalysisResults(activeView).Any();
    5759    }
    5860
    5961    public override void Execute() {
    6062      IContentView activeView = MainFormManager.MainForm.ActiveView as IContentView;
    61       if ((activeView != null) && (activeView.Content != null) && (activeView.Content is IOptimizer) && !activeView.Locked) {
    62         var optimizer = activeView.Content as IOptimizer;
    63         var solutionGroups = from pair in GetDataAnalysisResults(optimizer)
    64                              group pair.Value by pair.Key into g
    65                              select g;
    66         foreach (var group in solutionGroups) {
    67           // check if all solutions in the group are either only regression or only classification solutions
    68           if (group.All(s => s is IRegressionSolution)) {
    69             // show all regression ensembles
    70             // clone problemdata (N.B. this assumes all solutions are based on the same problem data!)
    71             var problemData = (RegressionProblemData)group
    72               .OfType<IRegressionSolution>()
    73               .First()
    74               .ProblemData.Clone();
    75             var ensemble = new RegressionEnsembleSolution(problemData);
    76             ensemble.Name = group.Key + " ensemble";
    77             var nestedSolutions = group.OfType<RegressionEnsembleSolution>().SelectMany(e => e.RegressionSolutions);
    78             var solutions = group.Where(s => !(s is RegressionEnsembleSolution)).OfType<IRegressionSolution>();
    79             ensemble.AddRegressionSolutions(nestedSolutions.Concat(solutions));
    80             MainFormManager.MainForm.ShowContent(ensemble);
    81           } else if (group.All(s => s is IClassificationSolution)) {
    82             // show all classification ensembles
    83             var problemData = (ClassificationProblemData)group
    84               .OfType<IClassificationSolution>()
    85               .First()
    86               .ProblemData.Clone();
    87             var ensemble = new ClassificationEnsembleSolution(Enumerable.Empty<IClassificationModel>(), problemData);
    88             ensemble.Name = group.Key + " ensemble";
    89             var nestedSolutions = group.OfType<ClassificationEnsembleSolution>().SelectMany(e => e.ClassificationSolutions);
    90             var solutions = group.Where(s => !(s is ClassificationEnsembleSolution)).OfType<IClassificationSolution>();
    91             ensemble.AddClassificationSolutions(nestedSolutions.Concat(solutions));
    92             MainFormManager.MainForm.ShowContent(ensemble);
    93           }
     63      var solutionGroups = from pair in GetDataAnalysisResults(activeView)
     64                           group pair.Value by pair.Key into g
     65                           select g;
     66      foreach (var group in solutionGroups) {
     67        // check if all solutions in the group are either only regression or only classification solutions
     68        if (group.All(s => s is IRegressionSolution)) {
     69          // show all regression ensembles
     70          // clone problemdata (N.B. this assumes all solutions are based on the same problem data!)
     71          var problemData = (RegressionProblemData)group
     72            .OfType<IRegressionSolution>()
     73            .First()
     74            .ProblemData.Clone();
     75          var ensemble = new RegressionEnsembleSolution(problemData);
     76          ensemble.Name = group.Key + " ensemble";
     77          var nestedSolutions = group.OfType<RegressionEnsembleSolution>().SelectMany(e => e.RegressionSolutions);
     78          var solutions = group.Where(s => !(s is RegressionEnsembleSolution)).OfType<IRegressionSolution>();
     79          ensemble.AddRegressionSolutions(nestedSolutions.Concat(solutions));
     80          MainFormManager.MainForm.ShowContent(ensemble);
     81        } else if (group.All(s => s is IClassificationSolution)) {
     82          // show all classification ensembles
     83          var problemData = (ClassificationProblemData)group
     84            .OfType<IClassificationSolution>()
     85            .First()
     86            .ProblemData.Clone();
     87          var ensemble = new ClassificationEnsembleSolution(Enumerable.Empty<IClassificationModel>(), problemData);
     88          ensemble.Name = group.Key + " ensemble";
     89          var nestedSolutions = group.OfType<ClassificationEnsembleSolution>().SelectMany(e => e.ClassificationSolutions);
     90          var solutions = group.Where(s => !(s is ClassificationEnsembleSolution)).OfType<IClassificationSolution>();
     91          ensemble.AddClassificationSolutions(nestedSolutions.Concat(solutions));
     92          MainFormManager.MainForm.ShowContent(ensemble);
    9493        }
    9594      }
    9695    }
    9796
    98     private IEnumerable<KeyValuePair<string, IItem>> GetDataAnalysisResults(IOptimizer optimizer) {
    99       var allResults = from r in optimizer.Runs
     97    private IEnumerable<KeyValuePair<string, IItem>> GetDataAnalysisResults(IContentView view) {
     98      var empty = Enumerable.Empty<KeyValuePair<string, IItem>>();
     99      if (view == null) return empty;
     100      if (view.Content == null) return empty;
     101      if (view.Locked) return empty;
     102
     103      var optimizer = view.Content as IOptimizer;
     104      if (optimizer != null) return GetDataAnalysisResults(optimizer.Runs);
     105
     106      RunCollectionBubbleChartView bubbleChart;
     107      var viewHost = view as ViewHost;
     108      if (viewHost != null)
     109        bubbleChart = viewHost.ActiveView as RunCollectionBubbleChartView;
     110      else bubbleChart = view as RunCollectionBubbleChartView;
     111      if (bubbleChart != null && bubbleChart.SelectedRuns.Any()) return GetDataAnalysisResults(bubbleChart.SelectedRuns);
     112
     113      return empty;
     114    }
     115
     116    private IEnumerable<KeyValuePair<string, IItem>> GetDataAnalysisResults(IEnumerable<IRun> runs) {
     117      var allResults = from r in runs
    100118                       select r.Results;
    101119      return from r in allResults
  • branches/OaaS/HeuristicLab.Problems.DataAnalysis.Views/3.4/Plugin.cs.frame

    r7294 r9363  
    2626
    2727namespace HeuristicLab.Problems.DataAnalysis.Views {
    28   [Plugin("HeuristicLab.Problems.DataAnalysis.Views", "Provides views for base classes for data analysis tasks.", "3.4.2.$WCREV$")]
     28  [Plugin("HeuristicLab.Problems.DataAnalysis.Views", "Provides views for base classes for data analysis tasks.", "3.4.3.$WCREV$")]
    2929  [PluginFile("HeuristicLab.Problems.DataAnalysis.Views-3.4.dll", PluginFileType.Assembly)]
     30  [PluginDependency("HeuristicLab.ALGLIB", "3.7.0")]
     31  [PluginDependency("HeuristicLab.Analysis", "3.3")]
     32  [PluginDependency("HeuristicLab.Collections", "3.3")]
    3033  [PluginDependency("HeuristicLab.Common", "3.3")]
    3134  [PluginDependency("HeuristicLab.Common.Resources", "3.3")]
     
    4447  }
    4548}
     49
  • branches/OaaS/HeuristicLab.Problems.DataAnalysis.Views/3.4/Properties/AssemblyInfo.cs.frame

    r7259 r9363  
    5353// by using the '*' as shown below:
    5454[assembly: AssemblyVersion("3.4.0.0")]
    55 [assembly: AssemblyFileVersion("3.4.2.$WCREV$")]
     55[assembly: AssemblyFileVersion("3.4.3.$WCREV$")]
  • branches/OaaS/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionEnsembleSolutionModelView.cs

    r7259 r9363  
    2020#endregion
    2121
     22using System;
    2223using System.Linq;
    2324using System.Windows.Forms;
    2425using HeuristicLab.Common;
     26using HeuristicLab.Core;
    2527using HeuristicLab.Core.Views;
    2628using HeuristicLab.MainForm;
     
    8385            solutions = solutions.Select(s => cloner.Clone(s));
    8486          }
    85           foreach (var solution in solutions)
    86             Content.Add(solution);
     87          var solutionCollection = Content as ItemCollection<IRegressionSolution>;
     88          if (solutionCollection != null) {
     89            solutionCollection.AddRange(solutions);
     90          } else {
     91            foreach (var solution in solutions)
     92              Content.Add(solution);
     93          }
     94        }
     95      }
     96      protected override void itemsListView_KeyDown(object sender, KeyEventArgs e) {
     97        var solutionCollection = Content as ItemCollection<IRegressionSolution>;
     98        if (e.KeyCode == Keys.Delete && solutionCollection != null) {
     99          if ((itemsListView.SelectedItems.Count > 0) && !Content.IsReadOnly && !ReadOnly) {
     100            solutionCollection.RemoveRange(itemsListView.SelectedItems.Cast<ListViewItem>().Select(x => (IRegressionSolution)x.Tag));
     101          }
     102        } else {
     103          base.itemsListView_KeyDown(sender, e);
     104        }
     105      }
     106      protected override void removeButton_Click(object sender, EventArgs e) {
     107        var solutionCollection = Content as ItemCollection<IRegressionSolution>;
     108        if (itemsListView.SelectedItems.Count > 0 && solutionCollection != null) {
     109          solutionCollection.RemoveRange(itemsListView.SelectedItems.Cast<ListViewItem>().Select(x => (IRegressionSolution)x.Tag));
     110          itemsListView.SelectedItems.Clear();
     111        } else {
     112          base.removeButton_Click(sender, e);
    87113        }
    88114      }
  • branches/OaaS/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionErrorCharacteristicsCurveView.Designer.cs

    r8105 r9363  
    1 namespace HeuristicLab.Problems.DataAnalysis.Views {
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
     22namespace HeuristicLab.Problems.DataAnalysis.Views {
    223  partial class RegressionSolutionErrorCharacteristicsCurveView {
    324    /// <summary>
  • branches/OaaS/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionErrorCharacteristicsCurveView.cs

    r8139 r9363  
    235235    private IRegressionSolution CreateConstantModel() {
    236236      double averageTrainingTarget = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TrainingIndices).Average();
    237       var solution = new ConstantRegressionModel(averageTrainingTarget).CreateRegressionSolution(ProblemData);
     237      var model = new ConstantRegressionModel(averageTrainingTarget);
     238      var solution = new ConstantRegressionSolution(model,(IRegressionProblemData)ProblemData.Clone());
    238239      solution.Name = "Baseline";
    239240      return solution;
  • branches/OaaS/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionLineChartView.cs

    r8139 r9363  
    8989        this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME].LegendText = ESTIMATEDVALUES_ALL_SERIES_NAME;
    9090        this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME].ChartType = SeriesChartType.FastLine;
    91         this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME].Points.DataBindXY(allIndices, allEstimatedValues);
    92         this.InsertEmptyPoints(this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME]);
     91        if (allEstimatedValues.Count > 0) {
     92          this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME].Points.DataBindXY(allIndices, allEstimatedValues);
     93          this.InsertEmptyPoints(this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME]);
     94        }
    9395        this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME].Tag = Content;
    9496        this.ToggleSeriesData(this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME]);
     
    224226
    225227        IEnumerable<int> indices = null;
    226         IEnumerable<double> predictedValues = null;
     228        double[] predictedValues = null;
    227229        switch (series.Name) {
    228230          case ESTIMATEDVALUES_ALL_SERIES_NAME:
    229231            indices = Enumerable.Range(0, Content.ProblemData.Dataset.Rows).Except(Content.ProblemData.TrainingIndices).Except(Content.ProblemData.TestIndices).ToArray();
    230232            var estimatedValues = Content.EstimatedValues.ToArray();
    231             predictedValues = indices.Select(index => estimatedValues[index]).ToList();
     233            predictedValues = indices.Select(index => estimatedValues[index]).ToArray();
    232234            break;
    233235          case ESTIMATEDVALUES_TRAINING_SERIES_NAME:
     
    240242            break;
    241243        }
    242         series.Points.DataBindXY(indices, predictedValues);
    243         this.InsertEmptyPoints(series);
     244        if (predictedValues.Length > 0) {
     245          series.Points.DataBindXY(indices, predictedValues);
     246          this.InsertEmptyPoints(series);
     247        }
    244248        chart.Legends[series.Legend].ForeColor = Color.Black;
    245249        UpdateCursorInterval();
  • branches/OaaS/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionResidualHistogram.Designer.cs

    r8104 r9363  
    1 namespace HeuristicLab.Problems.DataAnalysis.Views {
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
     22namespace HeuristicLab.Problems.DataAnalysis.Views {
    223  partial class RegressionSolutionResidualHistogram {
    324    /// <summary>
  • branches/OaaS/HeuristicLab.Problems.DataAnalysis.Views/3.4/Solution Views/DataAnalysisSolutionView.cs

    r8125 r9363  
    147147    }
    148148
     149    protected override void RebuildImageList() {
     150      itemsListView.SmallImageList.Images.Clear();
     151      foreach (ListViewItem listViewItem in itemsListView.Items) {
     152        IResult result = listViewItem.Tag as IResult;
     153        Type viewType = listViewItem.Tag as Type;
     154        if (result != null) itemsListView.SmallImageList.Images.Add(result.ItemImage);
     155        else if (viewType != null && typeof(IDataAnalysisSolutionEvaluationView).IsAssignableFrom(viewType))
     156          itemsListView.SmallImageList.Images.Add(((IDataAnalysisSolutionEvaluationView)Activator.CreateInstance(viewType)).ViewImage);
     157        else itemsListView.SmallImageList.Images.Add(HeuristicLab.Common.Resources.VSImageLibrary.Nothing);
     158
     159        listViewItem.ImageIndex = itemsListView.SmallImageList.Images.Count - 1;
     160      }
     161    }
     162
    149163    #region drag and drop
    150164    protected override void itemsListView_DragEnter(object sender, DragEventArgs e) {
  • branches/OaaS/HeuristicLab.Problems.DataAnalysis.Views/3.4/Solution Views/NamedDataAnalysisSolutionView.Designer.cs

    r7967 r9363  
    1 namespace HeuristicLab.Problems.DataAnalysis.Views.Solution_Views {
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
     22namespace HeuristicLab.Problems.DataAnalysis.Views.Solution_Views {
    223  partial class NamedDataAnalysisSolutionView {
    324    /// <summary>
  • branches/OaaS/HeuristicLab.Problems.DataAnalysis.Views/3.4/Solution Views/NamedDataAnalysisSolutionView.cs

    r7259 r9363  
    5353        contentType = Content.GetType();
    5454        panel.Controls.Clear();
    55         var viewType = MainFormManager.GetViewTypes(Content.GetType(), true).Where(t => typeof(DataAnalysisSolutionView).IsAssignableFrom(t)).FirstOrDefault();
     55        var viewType = MainFormManager.GetViewTypes(Content.GetType(), true).FirstOrDefault(t => typeof(DataAnalysisSolutionView).IsAssignableFrom(t));
    5656        if (viewType != null) {
    57           view = (DataAnalysisSolutionView)Activator.CreateInstance(viewType);
     57          view = (DataAnalysisSolutionView)MainFormManager.CreateView(viewType);
     58          view.Locked = Locked;
     59          view.ReadOnly = ReadOnly;
    5860          view.Dock = DockStyle.Fill;
    5961          view.Content = Content;
Note: See TracChangeset for help on using the changeset viewer.