Free cookie consent management tool by TermsFeed Policy Generator

Changeset 8508


Ignore:
Timestamp:
08/20/12 17:24:14 (10 years ago)
Author:
sforsten
Message:

#1776: merged r7864:8507 trunk into branch

Location:
branches/ClassificationEnsembleVoting
Files:
58 edited
3 copied

Legend:

Unmodified
Added
Removed
  • branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis

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

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

    r8101 r8508  
    115115      //
    116116      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    117       this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     117      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
    118118      this.Controls.Add(this.WrongClassifiedConfidence);
    119119      this.Controls.Add(this.WrongClassifiedConfidenceLabel);
  • branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationEnsembleSolutionEstimatedClassValuesView.cs

    r8297 r8508  
    8282          }
    8383        case SamplesComboBoxTrainingSamples: {
    84             indizes = Content.ProblemData.TrainingIndizes.ToArray();
     84            indizes = Content.ProblemData.TrainingIndices.ToArray();
    8585            estimatedClassValues = Content.EstimatedTrainingClassValues.ToArray();
    8686            break;
    8787          }
    8888        case SamplesComboBoxTestSamples: {
    89             indizes = Content.ProblemData.TestIndizes.ToArray();
     89            indizes = Content.ProblemData.TestIndices.ToArray();
    9090            estimatedClassValues = Content.EstimatedTestClassValues.ToArray();
    9191            break;
  • branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationEnsembleSolutionModelView.Designer.cs

    r7259 r8508  
    5050      //
    5151      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    52       this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     52      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
    5353      this.Name = "RegressionEnsembleSolutionModelView";
    5454      this.ResumeLayout(false);
  • branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationSolutionConfusionMatrixView.Designer.cs

    r5829 r8508  
    6565      //
    6666      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    67       this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     67      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
    6868      this.Controls.Add(this.label1);
    6969      this.Controls.Add(this.cmbSamples);
  • branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationSolutionConfusionMatrixView.cs

    r7259 r8508  
    107107        double[] predictedValues;
    108108        if (cmbSamples.SelectedItem.ToString() == TrainingSamples) {
    109           rows = Content.ProblemData.TrainingIndizes;
     109          rows = Content.ProblemData.TrainingIndices;
    110110          predictedValues = Content.EstimatedTrainingClassValues.ToArray();
    111111        } else if (cmbSamples.SelectedItem.ToString() == TestSamples) {
    112           rows = Content.ProblemData.TestIndizes;
     112          rows = Content.ProblemData.TestIndices;
    113113          predictedValues = Content.EstimatedTestClassValues.ToArray();
    114114        } else throw new InvalidOperationException();
  • branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationSolutionEstimatedClassValuesView.Designer.cs

    r7259 r8508  
    5050      this.AllowDrop = true;
    5151      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    52       this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     52      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
    5353      this.Name = "EstimatedValuesView";
    5454      this.Size = new System.Drawing.Size(310, 285);
  • branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationSolutionEstimatedClassValuesView.cs

    r7259 r8508  
    9696          var estimatedTraining = Content.EstimatedTrainingClassValues.GetEnumerator();
    9797          estimatedTraining.MoveNext();
    98           foreach (var trainingRow in Content.ProblemData.TrainingIndizes) {
     98          foreach (var trainingRow in Content.ProblemData.TrainingIndices) {
    9999            values[trainingRow, 3] = estimatedTraining.Current.ToString();
    100100            estimatedTraining.MoveNext();
     
    102102          var estimatedTest = Content.EstimatedTestClassValues.GetEnumerator();
    103103          estimatedTest.MoveNext();
    104           foreach (var testRow in Content.ProblemData.TestIndizes) {
     104          foreach (var testRow in Content.ProblemData.TestIndices) {
    105105            values[testRow, 4] = estimatedTest.Current.ToString();
    106106            estimatedTest.MoveNext();
  • branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/DiscriminantFunctionClassificationRocCurvesView.Designer.cs

    r5829 r8508  
    7676      //
    7777      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    78       this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     78      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
    7979      this.Controls.Add(this.label1);
    8080      this.Controls.Add(this.cmbSamples);
  • branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/DiscriminantFunctionClassificationRocCurvesView.cs

    r7259 r8508  
    101101
    102102        if (cmbSamples.SelectedItem.ToString() == TrainingSamples) {
    103           rows = Content.ProblemData.TrainingIndizes;
     103          rows = Content.ProblemData.TrainingIndices;
    104104        } else if (cmbSamples.SelectedItem.ToString() == TestSamples) {
    105           rows = Content.ProblemData.TestIndizes;
     105          rows = Content.ProblemData.TestIndices;
    106106        } else throw new InvalidOperationException();
    107107
  • branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/DiscriminantFunctionClassificationSolutionEstimatedClassValuesView.Designer.cs

    r7259 r8508  
    5050      this.AllowDrop = true;
    5151      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    52       this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     52      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
    5353      this.Name = "EstimatedValuesView";
    5454      this.Size = new System.Drawing.Size(310, 285);
  • branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/DiscriminantFunctionClassificationSolutionThresholdView.Designer.cs

    r5829 r8508  
    8080      //
    8181      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    82       this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     82      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
    8383      this.Controls.Add(this.label1);
    8484      this.Controls.Add(this.JitterTrackBar);
  • branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/DiscriminantFunctionClassificationSolutionThresholdView.cs

    r7259 r8508  
    137137      var targetValues = Content.ProblemData.Dataset.GetDoubleValues(Content.ProblemData.TargetVariable).ToList();
    138138
    139       foreach (int row in Content.ProblemData.TrainingIndizes) {
     139      foreach (int row in Content.ProblemData.TrainingIndices) {
    140140        double estimatedValue = estimatedValues[row];
    141141        double targetValue = targetValues[row];
     
    150150      }
    151151
    152       foreach (int row in Content.ProblemData.TestIndizes) {
     152      foreach (int row in Content.ProblemData.TestIndices) {
    153153        double estimatedValue = estimatedValues[row];
    154154        double targetValue = targetValues[row];
  • branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis.Views/3.4/Clustering/ClusteringSolutionEstimatedClusterView.Designer.cs

    r7259 r8508  
    5050      this.AllowDrop = true;
    5151      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    52       this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     52      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
    5353      this.Name = "EstimatedValuesView";
    5454      this.Size = new System.Drawing.Size(310, 285);
  • branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis.Views/3.4/DataAnalysisSolutionEvaluationView.Designer.cs

    r7259 r8508  
    4646    private void InitializeComponent() {
    4747      components = new System.ComponentModel.Container();
    48       this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     48      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
    4949    }
    5050
  • branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis.Views/3.4/HeuristicLab.Problems.DataAnalysis.Views-3.4.csproj

    r8329 r8508  
    9393  </PropertyGroup>
    9494  <ItemGroup>
    95     <Reference Include="HeuristicLab.Collections-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
    96     <Reference Include="HeuristicLab.Common-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
    97     <Reference Include="HeuristicLab.Common.Resources-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
    98     <Reference Include="HeuristicLab.Core-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
     95    <Reference Include="ALGLIB-3.6.0, Version=3.6.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     96      <HintPath>..\..\..\..\trunk\sources\bin\ALGLIB-3.6.0.dll</HintPath>
     97      <Private>False</Private>
     98    </Reference>
     99    <Reference Include="HeuristicLab.Analysis-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     100      <Private>False</Private>
     101    </Reference>
     102    <Reference Include="HeuristicLab.Collections-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     103      <Private>False</Private>
     104    </Reference>
     105    <Reference Include="HeuristicLab.Common-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     106      <Private>False</Private>
     107    </Reference>
     108    <Reference Include="HeuristicLab.Common.Resources-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     109      <Private>False</Private>
     110    </Reference>
     111    <Reference Include="HeuristicLab.Core-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     112      <Private>False</Private>
     113    </Reference>
    99114    <Reference Include="HeuristicLab.Core.Views-3.3">
    100115      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Core.Views-3.3.dll</HintPath>
    101     </Reference>
    102     <Reference Include="HeuristicLab.Data-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
     116      <Private>False</Private>
     117    </Reference>
     118    <Reference Include="HeuristicLab.Data-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     119      <Private>False</Private>
     120    </Reference>
    103121    <Reference Include="HeuristicLab.Data.Views-3.3">
    104122      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Data.Views-3.3.dll</HintPath>
     123      <Private>False</Private>
    105124    </Reference>
    106125    <Reference Include="HeuristicLab.MainForm-3.3">
    107126      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.MainForm-3.3.dll</HintPath>
     127      <Private>False</Private>
    108128    </Reference>
    109129    <Reference Include="HeuristicLab.MainForm.WindowsForms-3.3">
    110130      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.MainForm.WindowsForms-3.3.dll</HintPath>
    111     </Reference>
    112     <Reference Include="HeuristicLab.Optimization-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
     131      <Private>False</Private>
     132    </Reference>
     133    <Reference Include="HeuristicLab.Optimization-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     134      <Private>False</Private>
     135    </Reference>
    113136    <Reference Include="HeuristicLab.Optimization.Views-3.3">
    114137      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Optimization.Views-3.3.dll</HintPath>
     138      <Private>False</Private>
    115139    </Reference>
    116140    <Reference Include="HeuristicLab.Optimizer-3.3">
    117141      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Optimizer-3.3.dll</HintPath>
     142      <Private>False</Private>
    118143    </Reference>
    119144    <Reference Include="HeuristicLab.Parameters.Views-3.3">
    120145      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Parameters.Views-3.3.dll</HintPath>
    121     </Reference>
    122     <Reference Include="HeuristicLab.Persistence-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
    123     <Reference Include="HeuristicLab.PluginInfrastructure-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
     146      <Private>False</Private>
     147    </Reference>
     148    <Reference Include="HeuristicLab.Persistence-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     149      <Private>False</Private>
     150    </Reference>
     151    <Reference Include="HeuristicLab.PluginInfrastructure-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     152      <Private>False</Private>
     153    </Reference>
    124154    <Reference Include="HeuristicLab.Visualization.ChartControlsExtensions-3.3">
    125155      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Visualization.ChartControlsExtensions-3.3.dll</HintPath>
     156      <Private>False</Private>
    126157    </Reference>
    127158    <Reference Include="System" />
     
    153184    <Compile Include="Classification\ClassificationEnsembleSolutionModelView.Designer.cs">
    154185      <DependentUpon>ClassificationEnsembleSolutionModelView.cs</DependentUpon>
     186    </Compile>
     187    <Compile Include="Clustering\ClusteringSolutionVisualizationView.cs">
     188      <SubType>UserControl</SubType>
     189    </Compile>
     190    <Compile Include="Clustering\ClusteringSolutionVisualizationView.Designer.cs">
     191      <DependentUpon>ClusteringSolutionVisualizationView.cs</DependentUpon>
    155192    </Compile>
    156193    <Compile Include="Classification\ClassificationEnsembleSolutionConfidenceAccuracyDependence.cs">
  • branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis.Views/3.4/Plugin.cs.frame

    r7294 r8508  
    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.6.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")]
  • branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis.Views/3.4/Properties/AssemblyInfo.cs.frame

    r7259 r8508  
    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/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionEnsembleSolutionModelView.Designer.cs

    r7259 r8508  
    5050      //
    5151      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    52       this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     52      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
    5353      this.Name = "RegressionEnsembleSolutionModelView";
    5454      this.ResumeLayout(false);
  • branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionErrorCharacteristicsCurveView.Designer.cs

    r7866 r8508  
    3636      //
    3737      this.chart.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    38             | System.Windows.Forms.AnchorStyles.Left)
    39             | System.Windows.Forms.AnchorStyles.Right)));
     38                  | System.Windows.Forms.AnchorStyles.Left)
     39                  | System.Windows.Forms.AnchorStyles.Right)));
    4040      chartArea1.Name = "ChartArea1";
    4141      this.chart.ChartAreas.Add(chartArea1);
     
    7373      // RegressionSolutionErrorCharacteristicsCurveView
    7474      //
    75       this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    76       this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     75      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
    7776      this.Controls.Add(this.label1);
    7877      this.Controls.Add(this.cmbSamples);
  • branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionErrorCharacteristicsCurveView.cs

    r7866 r8508  
    2626using System.Windows.Forms.DataVisualization.Charting;
    2727using HeuristicLab.MainForm;
    28 using HeuristicLab.MainForm.WindowsForms;
    2928
    3029namespace HeuristicLab.Problems.DataAnalysis.Views {
     
    3231  [Content(typeof(IRegressionSolution))]
    3332  public partial class RegressionSolutionErrorCharacteristicsCurveView : DataAnalysisSolutionEvaluationView {
    34     private IRegressionSolution constantModel;
    3533    protected const string TrainingSamples = "Training";
    3634    protected const string TestSamples = "Test";
     
    103101      if (Content == null) return;
    104102
     103      var constantModel = CreateConstantModel();
    105104      var originalValues = GetOriginalValues().ToList();
    106       constantModel = CreateConstantModel();
    107105      var baselineEstimatedValues = GetEstimatedValues(constantModel);
    108106      var baselineResiduals = GetResiduals(originalValues, baselineEstimatedValues);
     
    117115      baselineSeries.ToolTip = "Area over Curve: " + CalculateAreaOverCurve(baselineSeries);
    118116      baselineSeries.Tag = constantModel;
     117      baselineSeries.LegendToolTip = "Double-click to open model";
    119118      chart.Series.Add(baselineSeries);
    120119
     
    131130      UpdateSeries(estimatedValues, solutionSeries);
    132131      solutionSeries.ToolTip = "Area over Curve: " + CalculateAreaOverCurve(solutionSeries);
     132      solutionSeries.LegendToolTip = "Double-click to open model";
    133133      chart.Series.Add(solutionSeries);
    134134    }
     
    169169      switch (cmbSamples.SelectedItem.ToString()) {
    170170        case TrainingSamples:
    171           originalValues = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TrainingIndizes);
     171          originalValues = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TrainingIndices);
    172172          break;
    173173        case TestSamples:
    174           originalValues = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TestIndizes);
     174          originalValues = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TestIndices);
    175175          break;
    176176        case AllSamples:
     
    201201    }
    202202
    203     protected IEnumerable<double> GetbaselineEstimatedValues(IEnumerable<double> originalValues) {
    204       double averageTrainingTarget = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TrainingIndizes).Average();
    205       return Enumerable.Repeat(averageTrainingTarget, originalValues.Count());
    206     }
    207 
    208203    protected virtual List<double> GetResiduals(IEnumerable<double> originalValues, IEnumerable<double> estimatedValues) {
    209204      return originalValues.Zip(estimatedValues, (x, y) => Math.Abs(x - y)).ToList();
     
    239234
    240235    private IRegressionSolution CreateConstantModel() {
    241       double averageTrainingTarget = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TrainingIndizes).Average();
     236      double averageTrainingTarget = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TrainingIndices).Average();
    242237      var solution = new ConstantRegressionModel(averageTrainingTarget).CreateRegressionSolution(ProblemData);
    243238      solution.Name = "Baseline";
     
    248243    private void chart_MouseMove(object sender, MouseEventArgs e) {
    249244      HitTestResult result = chart.HitTest(e.X, e.Y);
    250       if (result.ChartElementType == ChartElementType.LegendItem)
     245      if (result.ChartElementType == ChartElementType.LegendItem) {
    251246        Cursor = Cursors.Hand;
    252       else
     247      } else {
    253248        Cursor = Cursors.Default;
     249      }
    254250    }
    255251  }
  • branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionEstimatedValuesView.Designer.cs

    r7259 r8508  
    5050      this.AllowDrop = true;
    5151      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    52       this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     52      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
    5353      this.Name = "EstimatedValuesView";
    5454      this.Size = new System.Drawing.Size(310, 285);
  • branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionEstimatedValuesView.cs

    r7259 r8508  
    9393          var estimated_test = Content.EstimatedTestValues.GetEnumerator();
    9494
    95           foreach (var row in Content.ProblemData.TrainingIndizes) {
     95          foreach (var row in Content.ProblemData.TrainingIndices) {
    9696            estimated_training.MoveNext();
    9797            values[row, 3] = estimated_training.Current.ToString();
    9898          }
    9999
    100           foreach (var row in Content.ProblemData.TestIndizes) {
     100          foreach (var row in Content.ProblemData.TestIndices) {
    101101            estimated_test.MoveNext();
    102102            values[row, 4] = estimated_test.Current.ToString();
  • branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionLineChartView.Designer.cs

    r7259 r8508  
    7272      this.AllowDrop = true;
    7373      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    74       this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     74      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
    7575      this.Controls.Add(this.chart);
    7676      this.Name = "RegressionSolutionLineChartView";
  • branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionLineChartView.cs

    r7406 r8508  
    7272        this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].ChartType = SeriesChartType.FastLine;
    7373        this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].EmptyPointStyle.Color = this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].Color;
    74         this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].Points.DataBindXY(Content.ProblemData.TrainingIndizes.ToArray(), Content.EstimatedTrainingValues.ToArray());
     74        this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].Points.DataBindXY(Content.ProblemData.TrainingIndices.ToArray(), Content.EstimatedTrainingValues.ToArray());
    7575        this.InsertEmptyPoints(this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME]);
    7676        this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].Tag = Content;
     
    7979        this.chart.Series[ESTIMATEDVALUES_TEST_SERIES_NAME].LegendText = ESTIMATEDVALUES_TEST_SERIES_NAME;
    8080        this.chart.Series[ESTIMATEDVALUES_TEST_SERIES_NAME].ChartType = SeriesChartType.FastLine;
    81         this.chart.Series[ESTIMATEDVALUES_TEST_SERIES_NAME].Points.DataBindXY(Content.ProblemData.TestIndizes.ToArray(), Content.EstimatedTestValues.ToArray());
     81        this.chart.Series[ESTIMATEDVALUES_TEST_SERIES_NAME].Points.DataBindXY(Content.ProblemData.TestIndices.ToArray(), Content.EstimatedTestValues.ToArray());
    8282        this.InsertEmptyPoints(this.chart.Series[ESTIMATEDVALUES_TEST_SERIES_NAME]);
    8383        this.chart.Series[ESTIMATEDVALUES_TEST_SERIES_NAME].Tag = Content;
    8484        // series of remaining points
    85         int[] allIndizes = Enumerable.Range(0, Content.ProblemData.Dataset.Rows).Except(Content.ProblemData.TrainingIndizes).Except(Content.ProblemData.TestIndizes).ToArray();
     85        int[] allIndices = Enumerable.Range(0, Content.ProblemData.Dataset.Rows).Except(Content.ProblemData.TrainingIndices).Except(Content.ProblemData.TestIndices).ToArray();
    8686        var estimatedValues = Content.EstimatedValues.ToArray();
    87         List<double> allEstimatedValues = allIndizes.Select(index => estimatedValues[index]).ToList();
     87        List<double> allEstimatedValues = allIndices.Select(index => estimatedValues[index]).ToList();
    8888        this.chart.Series.Add(ESTIMATEDVALUES_ALL_SERIES_NAME);
    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(allIndizes, 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]);
     
    170172
    171173      int[] attr = new int[Content.ProblemData.Dataset.Rows + 1]; // add a virtual last row that is again empty to simplify loop further down
    172       foreach (var row in Content.ProblemData.TrainingIndizes) {
     174      foreach (var row in Content.ProblemData.TrainingIndices) {
    173175        attr[row] += 1;
    174176      }
    175       foreach (var row in Content.ProblemData.TestIndizes) {
     177      foreach (var row in Content.ProblemData.TestIndices) {
    176178        attr[row] += 2;
    177179      }
     
    223225        string targetVariableName = Content.ProblemData.TargetVariable;
    224226
    225         IEnumerable<int> indizes = null;
    226         IEnumerable<double> predictedValues = null;
     227        IEnumerable<int> indices = null;
     228        double[] predictedValues = null;
    227229        switch (series.Name) {
    228230          case ESTIMATEDVALUES_ALL_SERIES_NAME:
    229             indizes = Enumerable.Range(0, Content.ProblemData.Dataset.Rows).Except(Content.ProblemData.TrainingIndizes).Except(Content.ProblemData.TestIndizes).ToArray();
     231            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 = indizes.Select(index => estimatedValues[index]).ToList();
     233            predictedValues = indices.Select(index => estimatedValues[index]).ToArray();
    232234            break;
    233235          case ESTIMATEDVALUES_TRAINING_SERIES_NAME:
    234             indizes = Content.ProblemData.TrainingIndizes.ToArray();
     236            indices = Content.ProblemData.TrainingIndices.ToArray();
    235237            predictedValues = Content.EstimatedTrainingValues.ToArray();
    236238            break;
    237239          case ESTIMATEDVALUES_TEST_SERIES_NAME:
    238             indizes = Content.ProblemData.TestIndizes.ToArray();
     240            indices = Content.ProblemData.TestIndices.ToArray();
    239241            predictedValues = Content.EstimatedTestValues.ToArray();
    240242            break;
    241243        }
    242         series.Points.DataBindXY(indizes, 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/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionResidualHistogram.Designer.cs

    r7866 r8508  
    4141      this.chart.Location = new System.Drawing.Point(0, 0);
    4242      this.chart.Name = "chart";
    43       this.chart.Size = new System.Drawing.Size(358, 225);
     43      this.chart.Size = new System.Drawing.Size(289, 220);
    4444      this.chart.TabIndex = 0;
    4545      this.chart.CustomizeLegend += new System.EventHandler<System.Windows.Forms.DataVisualization.Charting.CustomizeLegendEventArgs>(this.chart_CustomizeLegend);
     
    5050      //
    5151      this.AllowDrop = true;
    52       this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    53       this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     52      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
    5453      this.Controls.Add(this.chart);
    5554      this.Name = "RegressionSolutionResidualHistogram";
  • branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionResidualHistogram.cs

    r7866 r8508  
    3939    protected const string TEST_SAMPLES = "Test samples";
    4040    /// <summary>
    41     /// used to reduce code duplication
    42     /// </summary>
    43     protected static string[] ALL_SERIES = new string[] { ALL_SAMPLES, TRAINING_SAMPLES, TEST_SAMPLES };
    44     /// <summary>
    4541    /// approximate amount of bins
    4642    /// </summary>
    4743    protected const double bins = 25;
    48     /// <summary>
    49     ///  keeps for all series a list for every bin with the position of the bin, the relative frequency of the
    50     ///  residuals and the beginning and the end of the interval of the bin
    51     ///  </summary>
    52     protected Dictionary<string, List<List<double>>> relativeFrequencies;
    5344    #endregion
    5445
     
    6152      : base() {
    6253      InitializeComponent();
    63       relativeFrequencies = new Dictionary<string, List<List<double>>>();
    64       foreach (string series in ALL_SERIES) {
     54      foreach (string series in new List<String>() { ALL_SAMPLES, TRAINING_SAMPLES, TEST_SAMPLES }) {
    6555        chart.Series.Add(series);
    6656        chart.Series[series].LegendText = series;
     
    7161        chart.Series[series].BorderColor = Color.Black;
    7262        chart.Series[series].ToolTip = series + " Y = #VALY from #CUSTOMPROPERTY(from) to #CUSTOMPROPERTY(to)";
    73         relativeFrequencies[series] = new List<List<double>>();
    7463      }
    7564      //configure axis
     
    8776
    8877    private void RedrawChart() {
    89       foreach (string series in ALL_SERIES) {
    90         chart.Series[series].Points.Clear();
    91         relativeFrequencies[series].Clear();
     78      foreach (Series series in chart.Series) {
     79        series.Points.Clear();
    9280      }
    9381      if (Content != null) {
    94         Dictionary<string, List<double>> residuals = CalculateResiduals();
    95         double realMax = Math.Max(Math.Abs(residuals[ALL_SAMPLES].Min()), Math.Abs(residuals[ALL_SAMPLES].Max()));
    96         double roundedMax = HumanRoundMax(realMax);
    97         double intervalWidth = (roundedMax * 2.0) / bins;
    98         intervalWidth = HumanRoundMax(intervalWidth);
    99         // sets roundedMax to a value, so that zero will be in the middle of the x axis
    100         double help = realMax / intervalWidth;
    101         help = help % 1 < 0.5 ? (int)help : (int)help + 1;
    102         roundedMax = help * intervalWidth;
    103 
    104         foreach (string series in ALL_SERIES) {
    105           CalculateFrequencies(residuals[series], series, roundedMax, intervalWidth);
    106           if (!series.Equals(ALL_SAMPLES))
    107             ShowValues(chart.Series[series], relativeFrequencies[series]);
     82        List<double> residuals = CalculateResiduals(Content);
     83
     84        double max = 0.0;
     85        foreach (Series series in chart.Series) {
     86          CalculateFrequencies(residuals, series);
     87          double seriesMax = series.Points.Select(p => p.YValues.First()).Max();
     88          max = max < seriesMax ? seriesMax : max;
    10889        }
     90
     91        // ALL_SAMPLES has to be calculated to know its highest frequency, but it is not shown in the beginning
     92        chart.Series.First(s => s.Name.Equals(ALL_SAMPLES)).Points.Clear();
     93
     94        double roundedMax, intervalWidth;
     95        CalculateResidualParameters(residuals, out roundedMax, out intervalWidth);
    10996
    11097        ChartArea chartArea = chart.ChartAreas[0];
     
    11299        chartArea.AxisX.Maximum = roundedMax + intervalWidth;
    113100        // get the highest frequency of a residual of any series
    114         chartArea.AxisY.Maximum = (from series in relativeFrequencies.Values
    115                                    select (from residual in series
    116                                            select residual.ElementAt(1)).Max()).Max();
     101        chartArea.AxisY.Maximum = max;
    117102        if (chartArea.AxisY.Maximum < 0.1) {
    118103          chartArea.AxisY.Interval = 0.01;
     
    132117    }
    133118
    134     private Dictionary<string, List<double>> CalculateResiduals() {
    135       Dictionary<string, List<double>> residuals = new Dictionary<string, List<double>>();
    136 
    137       foreach (string series in ALL_SERIES) {
    138         residuals[series] = new List<double>();
    139       }
     119    private List<double> CalculateResiduals(IRegressionSolution solution) {
     120      List<double> residuals = new List<double>();
     121
     122      IRegressionProblemData problemdata = solution.ProblemData;
     123      List<double> targetValues = problemdata.Dataset.GetDoubleValues(Content.ProblemData.TargetVariable).ToList();
     124      List<double> estimatedValues = solution.EstimatedValues.ToList();
     125
     126      for (int i = 0; i < solution.ProblemData.Dataset.Rows; i++) {
     127        double residual = estimatedValues[i] - targetValues[i];
     128        residuals.Add(residual);
     129      }
     130      return residuals;
     131    }
     132
     133    private void CalculateFrequencies(List<double> residualValues, Series series) {
     134      double roundedMax, intervalWidth;
     135      CalculateResidualParameters(residualValues, out roundedMax, out intervalWidth);
     136
     137      IEnumerable<double> relevantResiduals = residualValues;
    140138      IRegressionProblemData problemdata = Content.ProblemData;
    141       List<double> targetValues = problemdata.Dataset.GetDoubleValues(Content.ProblemData.TargetVariable).ToList();
    142       List<double> estimatedValues = Content.EstimatedValues.ToList();
    143 
    144       for (int i = 0; i < Content.ProblemData.Dataset.Rows; i++) {
    145         double residual = estimatedValues[i] - targetValues[i];
    146         residuals[ALL_SAMPLES].Add(residual);
    147         if (i >= problemdata.TrainingPartition.Start && i < problemdata.TrainingPartition.End)
    148           residuals[TRAINING_SAMPLES].Add(residual);
    149         if (i >= problemdata.TestPartition.Start && i < problemdata.TestPartition.End)
    150           residuals[TEST_SAMPLES].Add(residual);
    151       }
    152       return residuals;
    153     }
    154 
    155     private void CalculateFrequencies(List<double> residualValues, string series, double max, double intervalWidth) {
     139      if (series.Name.Equals(TRAINING_SAMPLES)) {
     140        relevantResiduals = residualValues.Skip(problemdata.TrainingPartition.Start).Take(problemdata.TrainingPartition.Size);
     141      } else if (series.Name.Equals(TEST_SAMPLES)) {
     142        relevantResiduals = residualValues.Skip(problemdata.TestPartition.Start).Take(problemdata.TestPartition.Size);
     143      }
     144
    156145      double intervalCenter = intervalWidth / 2.0;
    157       double sampleCount = residualValues.Count();
    158       double current = -max;
     146      double sampleCount = relevantResiduals.Count();
     147      double current = -roundedMax;
     148      DataPointCollection seriesPoints = series.Points;
    159149
    160150      for (int i = 0; i <= bins; i++) {
    161         IEnumerable<double> help = residualValues.Where(x => x >= (current - intervalCenter) && x < (current + intervalCenter));
    162         relativeFrequencies[series].Add(new List<double>() { current, help.Count() / sampleCount, current - intervalCenter, current + intervalCenter });
     151        IEnumerable<double> help = relevantResiduals.Where(x => x >= (current - intervalCenter) && x < (current + intervalCenter));
     152        seriesPoints.AddXY(current, help.Count() / sampleCount);
     153        seriesPoints[seriesPoints.Count - 1]["from"] = (current - intervalCenter).ToString();
     154        seriesPoints[seriesPoints.Count - 1]["to"] = (current + intervalCenter).ToString();
    163155        current += intervalWidth;
    164156      }
    165157    }
    166158
    167     private double HumanRoundMax(double max) {
     159    private void ToggleSeriesData(Series series) {
     160      if (series.Points.Count > 0) {  //checks if series is shown
     161        if (chart.Series.Any(s => s != series && s.Points.Count > 0)) {
     162          series.Points.Clear();
     163        }
     164      } else if (Content != null) {
     165        List<double> residuals = CalculateResiduals(Content);
     166        CalculateFrequencies(residuals, series);
     167        chart.Legends[series.Legend].ForeColor = Color.Black;
     168        chart.Refresh();
     169      }
     170    }
     171
     172    private static void CalculateResidualParameters(List<double> residuals, out double roundedMax, out double intervalWidth) {
     173      double realMax = Math.Max(Math.Abs(residuals.Min()), Math.Abs(residuals.Max()));
     174      roundedMax = HumanRoundMax(realMax);
     175      intervalWidth = (roundedMax * 2.0) / bins;
     176      intervalWidth = HumanRoundMax(intervalWidth);
     177      // sets roundedMax to a value, so that zero will be in the middle of the x axis
     178      double help = realMax / intervalWidth;
     179      help = help % 1 < 0.5 ? (int)help : (int)help + 1;
     180      roundedMax = help * intervalWidth;
     181    }
     182
     183    private static double HumanRoundMax(double max) {
    168184      double base10;
    169185      if (max > 0) base10 = Math.Pow(10.0, Math.Floor(Math.Log10(max)));
     
    216232    }
    217233    #endregion
    218 
    219     private void ToggleSeriesData(Series series) {
    220       if (series.Points.Count > 0) {  //checks if series is shown
    221         if (chart.Series.Any(s => s != series && s.Points.Count > 0)) {
    222           series.Points.Clear();
    223         }
    224       } else if (Content != null) {
    225         ShowValues(series, relativeFrequencies[series.Name]);
    226         chart.Legends[series.Legend].ForeColor = Color.Black;
    227         chart.Refresh();
    228       }
    229     }
    230     private void ShowValues(Series series, List<List<double>> relativeSeriesFrequencies) {
    231       DataPointCollection seriesPoints = series.Points;
    232 
    233       foreach (var valueList in relativeSeriesFrequencies) {
    234         seriesPoints.AddXY(valueList[0], valueList[1]);
    235         seriesPoints[seriesPoints.Count - 1]["from"] = valueList[2].ToString();
    236         seriesPoints[seriesPoints.Count - 1]["to"] = valueList[3].ToString();
    237       }
    238     }
    239234  }
    240235}
  • branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionScatterPlotView.cs

    r7259 r8508  
    119119      this.chart.ChartAreas[0].CursorX.Interval = zoomInterval;
    120120      this.chart.ChartAreas[0].CursorY.Interval = zoomInterval;
     121
     122      this.chart.ChartAreas[0].AxisX.ScaleView.SmallScrollSize = zoomInterval;
     123      this.chart.ChartAreas[0].AxisY.ScaleView.SmallScrollSize = zoomInterval;
     124
     125      this.chart.ChartAreas[0].AxisX.ScaleView.SmallScrollMinSizeType = DateTimeIntervalType.Number;
     126      this.chart.ChartAreas[0].AxisX.ScaleView.SmallScrollMinSize = zoomInterval;
     127      this.chart.ChartAreas[0].AxisY.ScaleView.SmallScrollMinSizeType = DateTimeIntervalType.Number;
     128      this.chart.ChartAreas[0].AxisY.ScaleView.SmallScrollMinSize = zoomInterval;
     129
     130      if (digits < 0) {
     131        this.chart.ChartAreas[0].AxisX.LabelStyle.Format = "F" + (int)Math.Abs(digits);
     132        this.chart.ChartAreas[0].AxisY.LabelStyle.Format = "F" + (int)Math.Abs(digits);
     133      } else {
     134        this.chart.ChartAreas[0].AxisX.LabelStyle.Format = "F0";
     135        this.chart.ChartAreas[0].AxisY.LabelStyle.Format = "F0";
     136      }
    121137    }
    122138
     
    132148        if (this.chart.Series[TRAINING_SERIES].Points.Count > 0)
    133149          this.chart.Series[TRAINING_SERIES].Points.DataBindXY(Content.EstimatedTrainingValues.ToArray(), "",
    134             dataset.GetDoubleValues(targetVariableName, Content.ProblemData.TrainingIndizes).ToArray(), "");
     150            dataset.GetDoubleValues(targetVariableName, Content.ProblemData.TrainingIndices).ToArray(), "");
    135151        if (this.chart.Series[TEST_SERIES].Points.Count > 0)
    136152          this.chart.Series[TEST_SERIES].Points.DataBindXY(Content.EstimatedTestValues.ToArray(), "",
    137            dataset.GetDoubleValues(targetVariableName, Content.ProblemData.TestIndizes).ToArray(), "");
     153           dataset.GetDoubleValues(targetVariableName, Content.ProblemData.TestIndices).ToArray(), "");
    138154
    139155        double max = Content.EstimatedTrainingValues.Concat(Content.EstimatedTestValues.Concat(Content.EstimatedValues.Concat(dataset.GetDoubleValues(targetVariableName)))).Max();
     
    180196          case TRAINING_SERIES:
    181197            predictedValues = Content.EstimatedTrainingValues.ToArray();
    182             targetValues = Content.ProblemData.Dataset.GetDoubleValues(targetVariableName, Content.ProblemData.TrainingIndizes).ToArray();
     198            targetValues = Content.ProblemData.Dataset.GetDoubleValues(targetVariableName, Content.ProblemData.TrainingIndices).ToArray();
    183199            break;
    184200          case TEST_SERIES:
    185201            predictedValues = Content.EstimatedTestValues.ToArray();
    186             targetValues = Content.ProblemData.Dataset.GetDoubleValues(targetVariableName, Content.ProblemData.TestIndizes).ToArray();
     202            targetValues = Content.ProblemData.Dataset.GetDoubleValues(targetVariableName, Content.ProblemData.TestIndices).ToArray();
    187203            break;
    188204        }
  • branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis.Views/3.4/Solution Views/ClassificationEnsembleSolutionView.Designer.cs

    r7464 r8508  
    8080      //
    8181      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    82       this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     82      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
    8383      this.Name = "ClassificationEnsembleSolutionView";
    8484      this.splitContainer.Panel1.ResumeLayout(false);
  • branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis.Views/3.4/Solution Views/ClassificationSolutionView.Designer.cs

    r7259 r8508  
    4646    private void InitializeComponent() {
    4747      components = new System.ComponentModel.Container();
    48       this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     48      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
    4949      this.itemsGroupBox.Text = "Classification Solution";
    5050    }
  • branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis.Views/3.4/Solution Views/ClusteringSolutionView.Designer.cs

    r7259 r8508  
    7171      //
    7272      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    73       this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     73      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
    7474      this.Name = "ClusteringSolutionView";
    7575      this.splitContainer.Panel1.ResumeLayout(false);
  • branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis.Views/3.4/Solution Views/DataAnalysisSolutionView.Designer.cs

    r7259 r8508  
    7070      //
    7171      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    72       this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     72      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
    7373      this.Name = "DataAnalysisSolutionView";
    7474      this.splitContainer.Panel1.ResumeLayout(false);
  • branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis.Views/3.4/Solution Views/DataAnalysisSolutionView.cs

    r7259 r8508  
    137137    }
    138138
     139    protected override void showDetailsCheckBox_CheckedChanged(object sender, EventArgs e) {
     140      if (showDetailsCheckBox.Checked && itemsListView.SelectedItems.Count == 1 && itemsListView.SelectedItems[0].Tag is Type) {
     141        Type viewType = (Type)itemsListView.SelectedItems[0].Tag;
     142        viewHost.ViewType = viewType;
     143        viewHost.Content = Content;
     144        splitContainer.Panel2Collapsed = false;
     145        detailsGroupBox.Enabled = true;
     146      } else base.showDetailsCheckBox_CheckedChanged(sender, e);
     147    }
     148
    139149    #region drag and drop
    140150    protected override void itemsListView_DragEnter(object sender, DragEventArgs e) {
  • branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis.Views/3.4/Solution Views/DiscriminantFunctionClassificationSolutionView.Designer.cs

    r7259 r8508  
    4646    private void InitializeComponent() {
    4747      components = new System.ComponentModel.Container();
    48       this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     48      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
    4949    }
    5050
  • branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis.Views/3.4/Solution Views/NamedDataAnalysisSolutionView.Designer.cs

    r6652 r8508  
    4646      //
    4747      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    48       this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     48      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
    4949      this.Controls.Add(this.panel);
    5050      this.Name = "NamedDataAnalysisSolutionView";
  • branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis.Views/3.4/Solution Views/RegressionEnsembleSolutionView.Designer.cs

    r7259 r8508  
    4545    private void InitializeComponent() {
    4646      components = new System.ComponentModel.Container();
    47       this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     47      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
    4848    }
    4949
  • branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis.Views/3.4/Solution Views/RegressionSolutionView.Designer.cs

    r7259 r8508  
    7171      //
    7272      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    73       this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     73      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
    7474      this.Name = "RegressionSolutionView";
    7575      this.splitContainer.Panel1.ResumeLayout(false);
  • branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/Dataset.cs

    r7866 r8508  
    131131        for (int col = 0; col < storableData.GetLength(1); col++) {
    132132          string columName = variableNames[col];
    133           var values = new List<double>();
    134           for (int row = 0; row < storableData.GetLength(0); row++) {
     133          var values = new List<double>(rows);
     134          for (int row = 0; row < rows; row++) {
    135135            values.Add(storableData[row, col]);
    136136          }
  • branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/HeuristicLab.Problems.DataAnalysis-3.4.csproj

    r8101 r8508  
    9595    <Reference Include="HeuristicLab.Collections-3.3">
    9696      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Collections-3.3.dll</HintPath>
     97      <Private>False</Private>
    9798    </Reference>
    9899    <Reference Include="HeuristicLab.Common-3.3">
    99100      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Common-3.3.dll</HintPath>
     101      <Private>False</Private>
    100102    </Reference>
    101103    <Reference Include="HeuristicLab.Common.Resources-3.3">
    102104      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Common.Resources-3.3.dll</HintPath>
     105      <Private>False</Private>
    103106    </Reference>
    104107    <Reference Include="HeuristicLab.Core-3.3">
    105108      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Core-3.3.dll</HintPath>
     109      <Private>False</Private>
    106110    </Reference>
    107111    <Reference Include="HeuristicLab.Data-3.3">
    108112      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Data-3.3.dll</HintPath>
     113      <Private>False</Private>
    109114    </Reference>
    110115    <Reference Include="HeuristicLab.Optimization-3.3">
    111116      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Optimization-3.3.dll</HintPath>
     117      <Private>False</Private>
    112118    </Reference>
    113119    <Reference Include="HeuristicLab.Parameters-3.3">
    114120      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Parameters-3.3.dll</HintPath>
     121      <Private>False</Private>
    115122    </Reference>
    116123    <Reference Include="HeuristicLab.Persistence-3.3">
    117124      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Persistence-3.3.dll</HintPath>
     125      <Private>False</Private>
    118126    </Reference>
    119127    <Reference Include="HeuristicLab.PluginInfrastructure-3.3">
    120128      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.PluginInfrastructure-3.3.dll</HintPath>
     129      <Private>False</Private>
    121130    </Reference>
    122131    <Reference Include="HeuristicLab.Problems.Instances-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     
    179188    <Compile Include="Interfaces\Regression\IRegressionEnsembleSolution.cs" />
    180189    <Compile Include="Implementation\Regression\RegressionSolutionBase.cs" />
     190    <Compile Include="OnlineCalculators\HoeffdingsDependenceCalculator.cs" />
    181191    <Compile Include="OnlineCalculators\OnlineMaxAbsoluteErrorCalculator.cs" />
    182192    <Compile Include="OnlineCalculators\OnlineMeanErrorCalculator.cs" />
  • branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/ClassificationEnsembleSolution.cs

    r8297 r8508  
    132132
    133133      while (modelEnumerator.MoveNext() & trainingPartitionEnumerator.MoveNext() & testPartitionEnumerator.MoveNext()) {
    134         var p = (IClassificationProblemData)problemData.Clone();
     134        IClassificationProblemData p = (IClassificationProblemData)ProblemData.Clone();
    135135        p.TrainingPartition.Start = trainingPartitionEnumerator.Current.Start;
    136136        p.TrainingPartition.End = trainingPartitionEnumerator.Current.End;
     
    169169        return weightCalculator.AggregateEstimatedClassValues(classificationSolutions.CheckedItems,
    170170                                                              ProblemData.Dataset,
    171                                                               ProblemData.TrainingIndizes,
     171                                                              ProblemData.TrainingIndices,
    172172                                                              weightCalculator.GetTrainingClassDelegate());
    173173      }
     
    178178        return weightCalculator.AggregateEstimatedClassValues(classificationSolutions.CheckedItems,
    179179                                                              ProblemData.Dataset,
    180                                                               ProblemData.TestIndizes,
     180                                                              ProblemData.TestIndices,
    181181                                                              weightCalculator.GetTestClassDelegate());
    182182      }
  • branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/ClassificationProblemData.cs

    r7866 r8508  
    207207
    208208    #region parameter properties
    209     public ConstrainedValueParameter<StringValue> TargetVariableParameter {
    210       get { return (ConstrainedValueParameter<StringValue>)Parameters[TargetVariableParameterName]; }
     209    public IConstrainedValueParameter<StringValue> TargetVariableParameter {
     210      get { return (IConstrainedValueParameter<StringValue>)Parameters[TargetVariableParameterName]; }
    211211    }
    212212    public IFixedValueParameter<StringMatrix> ClassNamesParameter {
  • branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/ClassificationSolution.cs

    r7259 r8508  
    4444    public ClassificationSolution(IClassificationModel model, IClassificationProblemData problemData)
    4545      : base(model, problemData) {
    46       evaluationCache = new Dictionary<int, double>();
     46      evaluationCache = new Dictionary<int, double>(problemData.Dataset.Rows);
    4747    }
    4848
     
    5151    }
    5252    public override IEnumerable<double> EstimatedTrainingClassValues {
    53       get { return GetEstimatedClassValues(ProblemData.TrainingIndizes); }
     53      get { return GetEstimatedClassValues(ProblemData.TrainingIndices); }
    5454    }
    5555    public override IEnumerable<double> EstimatedTestClassValues {
    56       get { return GetEstimatedClassValues(ProblemData.TestIndizes); }
     56      get { return GetEstimatedClassValues(ProblemData.TestIndices); }
    5757    }
    5858
  • branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/ClassificationSolutionBase.cs

    r7259 r8508  
    8787    protected void CalculateResults() {
    8888      double[] estimatedTrainingClassValues = EstimatedTrainingClassValues.ToArray(); // cache values
    89       double[] originalTrainingClassValues = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TrainingIndizes).ToArray();
     89      double[] originalTrainingClassValues = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TrainingIndices).ToArray();
    9090      double[] estimatedTestClassValues = EstimatedTestClassValues.ToArray(); // cache values
    91       double[] originalTestClassValues = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TestIndizes).ToArray();
     91      double[] originalTestClassValues = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TestIndices).ToArray();
    9292
    9393      OnlineCalculatorError errorState;
  • branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/DiscriminantFunctionClassificationSolution.cs

    r7259 r8508  
    5959    }
    6060    public override IEnumerable<double> EstimatedTrainingClassValues {
    61       get { return GetEstimatedClassValues(ProblemData.TrainingIndizes); }
     61      get { return GetEstimatedClassValues(ProblemData.TrainingIndices); }
    6262    }
    6363    public override IEnumerable<double> EstimatedTestClassValues {
    64       get { return GetEstimatedClassValues(ProblemData.TestIndizes); }
     64      get { return GetEstimatedClassValues(ProblemData.TestIndices); }
    6565    }
    6666
     
    8282    }
    8383    public override IEnumerable<double> EstimatedTrainingValues {
    84       get { return GetEstimatedValues(ProblemData.TrainingIndizes); }
     84      get { return GetEstimatedValues(ProblemData.TrainingIndices); }
    8585    }
    8686    public override IEnumerable<double> EstimatedTestValues {
    87       get { return GetEstimatedValues(ProblemData.TestIndizes); }
     87      get { return GetEstimatedValues(ProblemData.TestIndices); }
    8888    }
    8989
  • branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/DiscriminantFunctionClassificationSolutionBase.cs

    r7259 r8508  
    103103    protected void CalculateRegressionResults() {
    104104      double[] estimatedTrainingValues = EstimatedTrainingValues.ToArray(); // cache values
    105       double[] originalTrainingValues = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TrainingIndizes).ToArray();
     105      double[] originalTrainingValues = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TrainingIndices).ToArray();
    106106      double[] estimatedTestValues = EstimatedTestValues.ToArray(); // cache values
    107       double[] originalTestValues = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TestIndizes).ToArray();
     107      double[] originalTestValues = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TestIndices).ToArray();
    108108
    109109      OnlineCalculatorError errorState;
     
    140140      double[] classValues;
    141141      double[] thresholds;
    142       var targetClassValues = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TrainingIndizes);
     142      var targetClassValues = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TrainingIndices);
    143143      AccuracyMaximizationThresholdCalculator.CalculateThresholds(ProblemData, EstimatedTrainingValues, targetClassValues, out classValues, out thresholds);
    144144
     
    149149      double[] classValues;
    150150      double[] thresholds;
    151       var targetClassValues = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TrainingIndizes);
     151      var targetClassValues = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TrainingIndices);
    152152      NormalDistributionCutPointsThresholdCalculator.CalculateThresholds(ProblemData, EstimatedTrainingValues, targetClassValues, out classValues, out thresholds);
    153153
  • branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/ThresholdCalculators/AccuracyMaximizationThresholdCalculator.cs

    r7259 r8508  
    5454    public static void CalculateThresholds(IClassificationProblemData problemData, IEnumerable<double> estimatedValues, IEnumerable<double> targetClassValues, out double[] classValues, out double[] thresholds) {
    5555      int slices = 100;
     56      double minThresholdInc = 10e-5; // necessary to prevent infinite loop when maxEstimated - minEstimated is effectively zero (constant model)
    5657      List<double> estimatedValuesList = estimatedValues.ToList();
    5758      double maxEstimatedValue = estimatedValuesList.Max();
    5859      double minEstimatedValue = estimatedValuesList.Min();
    59       double thresholdIncrement = (maxEstimatedValue - minEstimatedValue) / slices;
     60      double thresholdIncrement = Math.Max((maxEstimatedValue - minEstimatedValue) / slices, minThresholdInc);
    6061      var estimatedAndTargetValuePairs =
    6162        estimatedValuesList.Zip(targetClassValues, (x, y) => new { EstimatedValue = x, TargetClassValue = y })
     
    7071
    7172      // incrementally calculate accuracy of all possible thresholds
    72       int[,] confusionMatrix = new int[nClasses, nClasses];
    73 
    7473      for (int i = 1; i < thresholds.Length; i++) {
    7574        double lowerThreshold = thresholds[i - 1];
  • branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Clustering/ClusteringSolution.cs

    r7259 r8508  
    6868    public virtual IEnumerable<int> TrainingClusterValues {
    6969      get {
    70         return GetClusterValues(ProblemData.TrainingIndizes);
     70        return GetClusterValues(ProblemData.TrainingIndices);
    7171      }
    7272    }
     
    7474    public virtual IEnumerable<int> TestClusterValues {
    7575      get {
    76         return GetClusterValues(ProblemData.TestIndizes);
     76        return GetClusterValues(ProblemData.TestIndices);
    7777      }
    7878    }
  • branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/DataAnalysisProblemData.cs

    r7265 r8508  
    7575    }
    7676
    77     public virtual IEnumerable<int> TrainingIndizes {
     77    public virtual IEnumerable<int> TrainingIndices {
    7878      get {
    7979        return Enumerable.Range(TrainingPartition.Start, Math.Max(0, TrainingPartition.End - TrainingPartition.Start))
     
    8181      }
    8282    }
    83     public virtual IEnumerable<int> TestIndizes {
     83    public virtual IEnumerable<int> TestIndices {
    8484      get {
    8585        return Enumerable.Range(TestPartition.Start, Math.Max(0, TestPartition.End - TestPartition.Start))
  • branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionEnsembleSolution.cs

    r7866 r8508  
    3737  [Creatable("Data Analysis - Ensembles")]
    3838  public sealed class RegressionEnsembleSolution : RegressionSolution, IRegressionEnsembleSolution {
     39    private readonly Dictionary<int, double> trainingEvaluationCache = new Dictionary<int, double>();
     40    private readonly Dictionary<int, double> testEvaluationCache = new Dictionary<int, double>();
     41
    3942    public new IRegressionEnsembleModel Model {
    4043      get { return (IRegressionEnsembleModel)base.Model; }
     
    5255
    5356    [Storable]
    54     private Dictionary<IRegressionModel, IntRange> trainingPartitions;
     57    private readonly Dictionary<IRegressionModel, IntRange> trainingPartitions;
    5558    [Storable]
    56     private Dictionary<IRegressionModel, IntRange> testPartitions;
     59    private readonly Dictionary<IRegressionModel, IntRange> testPartitions;
    5760
    5861    [StorableConstructor]
     
    8689      }
    8790
     91      trainingEvaluationCache = new Dictionary<int, double>(original.ProblemData.TrainingIndices.Count());
     92      testEvaluationCache = new Dictionary<int, double>(original.ProblemData.TestIndices.Count());
     93
    8894      regressionSolutions = cloner.Clone(original.regressionSolutions);
    8995      RegisterRegressionSolutionsEventHandler();
     
    133139      }
    134140
     141      trainingEvaluationCache = new Dictionary<int, double>(problemData.TrainingIndices.Count());
     142      testEvaluationCache = new Dictionary<int, double>(problemData.TestIndices.Count());
     143
    135144      RegisterRegressionSolutionsEventHandler();
    136145      regressionSolutions.AddRange(solutions);
     
    153162    public override IEnumerable<double> EstimatedTrainingValues {
    154163      get {
    155         var rows = ProblemData.TrainingIndizes;
    156         var estimatedValuesEnumerators = (from model in Model.Models
    157                                           select new { Model = model, EstimatedValuesEnumerator = model.GetEstimatedValues(ProblemData.Dataset, rows).GetEnumerator() })
    158                                          .ToList();
    159         var rowsEnumerator = rows.GetEnumerator();
    160         // aggregate to make sure that MoveNext is called for all enumerators
    161         while (rowsEnumerator.MoveNext() & estimatedValuesEnumerators.Select(en => en.EstimatedValuesEnumerator.MoveNext()).Aggregate(true, (acc, b) => acc & b)) {
    162           int currentRow = rowsEnumerator.Current;
    163 
    164           var selectedEnumerators = from pair in estimatedValuesEnumerators
    165                                     where RowIsTrainingForModel(currentRow, pair.Model) && !RowIsTestForModel(currentRow, pair.Model)
    166                                     select pair.EstimatedValuesEnumerator;
    167           yield return AggregateEstimatedValues(selectedEnumerators.Select(x => x.Current));
     164        var rows = ProblemData.TrainingIndices;
     165        var rowsToEvaluate = rows.Except(trainingEvaluationCache.Keys);
     166        var rowsEnumerator = rowsToEvaluate.GetEnumerator();
     167        var valuesEnumerator = GetEstimatedValues(rowsToEvaluate, (r, m) => RowIsTrainingForModel(r, m) && !RowIsTestForModel(r, m)).GetEnumerator();
     168
     169        while (rowsEnumerator.MoveNext() & valuesEnumerator.MoveNext()) {
     170          trainingEvaluationCache.Add(rowsEnumerator.Current, valuesEnumerator.Current);
    168171        }
     172
     173        return rows.Select(row => trainingEvaluationCache[row]);
    169174      }
    170175    }
     
    172177    public override IEnumerable<double> EstimatedTestValues {
    173178      get {
    174         var rows = ProblemData.TestIndizes;
    175         var estimatedValuesEnumerators = (from model in Model.Models
    176                                           select new { Model = model, EstimatedValuesEnumerator = model.GetEstimatedValues(ProblemData.Dataset, rows).GetEnumerator() })
    177                                          .ToList();
    178         var rowsEnumerator = ProblemData.TestIndizes.GetEnumerator();
    179         // aggregate to make sure that MoveNext is called for all enumerators
    180         while (rowsEnumerator.MoveNext() & estimatedValuesEnumerators.Select(en => en.EstimatedValuesEnumerator.MoveNext()).Aggregate(true, (acc, b) => acc & b)) {
    181           int currentRow = rowsEnumerator.Current;
    182 
    183           var selectedEnumerators = from pair in estimatedValuesEnumerators
    184                                     where RowIsTestForModel(currentRow, pair.Model)
    185                                     select pair.EstimatedValuesEnumerator;
    186 
    187           yield return AggregateEstimatedValues(selectedEnumerators.Select(x => x.Current));
     179        var rows = ProblemData.TestIndices;
     180        var rowsToEvaluate = rows.Except(testEvaluationCache.Keys);
     181        var rowsEnumerator = rowsToEvaluate.GetEnumerator();
     182        var valuesEnumerator = GetEstimatedValues(rowsToEvaluate, RowIsTestForModel).GetEnumerator();
     183
     184        while (rowsEnumerator.MoveNext() & valuesEnumerator.MoveNext()) {
     185          testEvaluationCache.Add(rowsEnumerator.Current, valuesEnumerator.Current);
    188186        }
     187
     188        return rows.Select(row => testEvaluationCache[row]);
     189      }
     190    }
     191
     192    private IEnumerable<double> GetEstimatedValues(IEnumerable<int> rows, Func<int, IRegressionModel, bool> modelSelectionPredicate) {
     193      var estimatedValuesEnumerators = (from model in Model.Models
     194                                        select new { Model = model, EstimatedValuesEnumerator = model.GetEstimatedValues(ProblemData.Dataset, rows).GetEnumerator() })
     195                                       .ToList();
     196      var rowsEnumerator = rows.GetEnumerator();
     197      // aggregate to make sure that MoveNext is called for all enumerators
     198      while (rowsEnumerator.MoveNext() & estimatedValuesEnumerators.Select(en => en.EstimatedValuesEnumerator.MoveNext()).Aggregate(true, (acc, b) => acc & b)) {
     199        int currentRow = rowsEnumerator.Current;
     200
     201        var selectedEnumerators = from pair in estimatedValuesEnumerators
     202                                  where modelSelectionPredicate(currentRow, pair.Model)
     203                                  select pair.EstimatedValuesEnumerator;
     204
     205        yield return AggregateEstimatedValues(selectedEnumerators.Select(x => x.Current));
    189206      }
    190207    }
     
    201218
    202219    public override IEnumerable<double> GetEstimatedValues(IEnumerable<int> rows) {
    203       return from xs in GetEstimatedValueVectors(ProblemData.Dataset, rows)
    204              select AggregateEstimatedValues(xs);
     220      var rowsToEvaluate = rows.Except(evaluationCache.Keys);
     221      var rowsEnumerator = rowsToEvaluate.GetEnumerator();
     222      var valuesEnumerator = (from xs in GetEstimatedValueVectors(ProblemData.Dataset, rowsToEvaluate)
     223                              select AggregateEstimatedValues(xs))
     224                             .GetEnumerator();
     225
     226      while (rowsEnumerator.MoveNext() & valuesEnumerator.MoveNext()) {
     227        evaluationCache.Add(rowsEnumerator.Current, valuesEnumerator.Current);
     228      }
     229
     230      return rows.Select(row => evaluationCache[row]);
    205231    }
    206232
     
    223249
    224250    protected override void OnProblemDataChanged() {
     251      trainingEvaluationCache.Clear();
     252      testEvaluationCache.Clear();
     253      evaluationCache.Clear();
    225254      IRegressionProblemData problemData = new RegressionProblemData(ProblemData.Dataset,
    226255                                                                     ProblemData.AllowedInputVariables,
     
    251280    public void AddRegressionSolutions(IEnumerable<IRegressionSolution> solutions) {
    252281      regressionSolutions.AddRange(solutions);
     282
     283      trainingEvaluationCache.Clear();
     284      testEvaluationCache.Clear();
     285      evaluationCache.Clear();
    253286    }
    254287    public void RemoveRegressionSolutions(IEnumerable<IRegressionSolution> solutions) {
    255288      regressionSolutions.RemoveRange(solutions);
     289
     290      trainingEvaluationCache.Clear();
     291      testEvaluationCache.Clear();
     292      evaluationCache.Clear();
    256293    }
    257294
     
    275312      trainingPartitions[solution.Model] = solution.ProblemData.TrainingPartition;
    276313      testPartitions[solution.Model] = solution.ProblemData.TestPartition;
     314
     315      trainingEvaluationCache.Clear();
     316      testEvaluationCache.Clear();
     317      evaluationCache.Clear();
    277318    }
    278319
     
    282323      trainingPartitions.Remove(solution.Model);
    283324      testPartitions.Remove(solution.Model);
     325
     326      trainingEvaluationCache.Clear();
     327      testEvaluationCache.Clear();
     328      evaluationCache.Clear();
    284329    }
    285330  }
  • branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionProblemData.cs

    r7866 r8508  
    9595    #endregion
    9696
    97     public ConstrainedValueParameter<StringValue> TargetVariableParameter {
    98       get { return (ConstrainedValueParameter<StringValue>)Parameters[TargetVariableParameterName]; }
     97    public IConstrainedValueParameter<StringValue> TargetVariableParameter {
     98      get { return (IConstrainedValueParameter<StringValue>)Parameters[TargetVariableParameterName]; }
    9999    }
    100100    public string TargetVariable {
  • branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionSolution.cs

    r7866 r8508  
    5555    }
    5656    public override IEnumerable<double> EstimatedTrainingValues {
    57       get { return GetEstimatedValues(ProblemData.TrainingIndizes); }
     57      get { return GetEstimatedValues(ProblemData.TrainingIndices); }
    5858    }
    5959    public override IEnumerable<double> EstimatedTestValues {
    60       get { return GetEstimatedValues(ProblemData.TestIndizes); }
     60      get { return GetEstimatedValues(ProblemData.TestIndices); }
    6161    }
    6262
  • branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionSolutionBase.cs

    r7866 r8508  
    138138        OnlineCalculatorError errorState;
    139139        Add(new Result(TrainingMeanAbsoluteErrorResultName, "Mean of absolute errors of the model on the training partition", new DoubleValue()));
    140         double trainingMAE = OnlineMeanAbsoluteErrorCalculator.Calculate(EstimatedTrainingValues, ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TrainingIndizes), out errorState);
     140        double trainingMAE = OnlineMeanAbsoluteErrorCalculator.Calculate(EstimatedTrainingValues, ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TrainingIndices), out errorState);
    141141        TrainingMeanAbsoluteError = errorState == OnlineCalculatorError.None ? trainingMAE : double.NaN;
    142142      }
     
    145145        OnlineCalculatorError errorState;
    146146        Add(new Result(TestMeanAbsoluteErrorResultName, "Mean of absolute errors of the model on the test partition", new DoubleValue()));
    147         double testMAE = OnlineMeanAbsoluteErrorCalculator.Calculate(EstimatedTestValues, ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TestIndizes), out errorState);
     147        double testMAE = OnlineMeanAbsoluteErrorCalculator.Calculate(EstimatedTestValues, ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TestIndices), out errorState);
    148148        TestMeanAbsoluteError = errorState == OnlineCalculatorError.None ? testMAE : double.NaN;
    149149      }
     
    152152        OnlineCalculatorError errorState;
    153153        Add(new Result(TrainingMeanErrorResultName, "Mean of errors of the model on the training partition", new DoubleValue()));
    154         double trainingME = OnlineMeanErrorCalculator.Calculate(EstimatedTrainingValues, ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TrainingIndizes), out errorState);
     154        double trainingME = OnlineMeanErrorCalculator.Calculate(EstimatedTrainingValues, ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TrainingIndices), out errorState);
    155155        TrainingMeanError = errorState == OnlineCalculatorError.None ? trainingME : double.NaN;
    156156      }
     
    158158        OnlineCalculatorError errorState;
    159159        Add(new Result(TestMeanErrorResultName, "Mean of errors of the model on the test partition", new DoubleValue()));
    160         double testME = OnlineMeanErrorCalculator.Calculate(EstimatedTestValues, ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TestIndizes), out errorState);
     160        double testME = OnlineMeanErrorCalculator.Calculate(EstimatedTestValues, ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TestIndices), out errorState);
    161161        TestMeanError = errorState == OnlineCalculatorError.None ? testME : double.NaN;
    162162      }
     
    166166    protected void CalculateResults() {
    167167      IEnumerable<double> estimatedTrainingValues = EstimatedTrainingValues; // cache values
    168       IEnumerable<double> originalTrainingValues = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TrainingIndizes);
     168      IEnumerable<double> originalTrainingValues = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TrainingIndices);
    169169      IEnumerable<double> estimatedTestValues = EstimatedTestValues; // cache values
    170       IEnumerable<double> originalTestValues = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TestIndizes);
     170      IEnumerable<double> originalTestValues = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TestIndices);
    171171
    172172      OnlineCalculatorError errorState;
  • branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/Interfaces/IDataAnalysisProblemData.cs

    r7259 r8508  
    3636    IntRange TestPartition { get; }
    3737
    38     IEnumerable<int> TrainingIndizes { get; }
    39     IEnumerable<int> TestIndizes { get; }
     38    IEnumerable<int> TrainingIndices { get; }
     39    IEnumerable<int> TestIndices { get; }
    4040
    4141    bool IsTrainingSample(int index);
  • branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/Interfaces/IOnlineCalculator.cs

    r7259 r8508  
    2424namespace HeuristicLab.Problems.DataAnalysis {
    2525  [Flags]
    26   public enum OnlineCalculatorError { 
     26  public enum OnlineCalculatorError {
    2727    /// <summary>
    2828    /// No error occurred
    2929    /// </summary>
    30     None = 0, 
     30    None = 0,
    3131    /// <summary>
    3232    /// An invalid value has been added (often +/- Infinity and NaN are invalid values)
    3333    /// </summary>
    34     InvalidValueAdded = 1, 
     34    InvalidValueAdded = 1,
    3535    /// <summary>
    3636    /// The number of elements added to the evaluator is not sufficient to calculate the result value
  • branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineLinearScalingParameterCalculator.cs

    r7259 r8508  
    5555    }
    5656
    57     private int cnt;
    5857    private OnlineMeanAndVarianceCalculator targetMeanCalculator;
    5958    private OnlineMeanAndVarianceCalculator originalMeanAndVarianceCalculator;
     
    6867
    6968    public void Reset() {
    70       cnt = 0;
    7169      targetMeanCalculator.Reset();
    7270      originalMeanAndVarianceCalculator.Reset();
     
    8583      originalTargetCovarianceCalculator.Add(original, target);
    8684
    87       cnt++;
    8885    }
    8986
  • branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/Plugin.cs.frame

    r7866 r8508  
    2626
    2727namespace HeuristicLab.Problems.DataAnalysis {
    28   [Plugin("HeuristicLab.Problems.DataAnalysis","Provides base classes for data analysis tasks.", "3.4.2.$WCREV$")]
     28  [Plugin("HeuristicLab.Problems.DataAnalysis","Provides base classes for data analysis tasks.", "3.4.3.$WCREV$")]
    2929  [PluginFile("HeuristicLab.Problems.DataAnalysis-3.4.dll", PluginFileType.Assembly)]
    3030  [PluginDependency("HeuristicLab.Collections", "3.3")]
  • branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/Properties/AssemblyInfo.cs.frame

    r7259 r8508  
    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$")]
Note: See TracChangeset for help on using the changeset viewer.