Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/30/11 17:31:53 (14 years ago)
Author:
abeham
Message:

#1465

  • updated branch from trunk
Location:
branches/histogram
Files:
8 edited
9 copied

Legend:

Unmodified
Added
Removed
  • branches/histogram

  • branches/histogram/HeuristicLab.Algorithms.DataAnalysis/3.4/CrossValidation.cs

    r6195 r6340  
    376376        results.Add(result.Name, result.Value);
    377377      }
     378      foreach (IResult result in ExtractAndAggregateClassificationSolutions(resultCollections)) {
     379        results.Add(result.Name, result.Value);
     380      }
    378381      results.Add("Execution Time", new TimeSpanValue(this.ExecutionTime));
    379382      results.Add("CrossValidation Folds", new RunCollection(runs));
     
    401404          solutions.Value.Select(x => x.ProblemData.TestPartition));
    402405
    403         aggregatedResults.Add(new Result(solutions.Key, ensembleSolution));
    404       }
    405       return aggregatedResults;
     406        aggregatedResults.Add(new Result(solutions.Key + " (ensemble)", ensembleSolution));
     407      }
     408      List<IResult> flattenedResults = new List<IResult>();
     409      CollectResultsRecursively("", aggregatedResults, flattenedResults);
     410      return flattenedResults;
     411    }
     412
     413    private IEnumerable<IResult> ExtractAndAggregateClassificationSolutions(IEnumerable<KeyValuePair<string, IItem>> resultCollections) {
     414      Dictionary<string, List<IClassificationSolution>> resultSolutions = new Dictionary<string, List<IClassificationSolution>>();
     415      foreach (var result in resultCollections) {
     416        var classificationSolution = result.Value as IClassificationSolution;
     417        if (classificationSolution != null) {
     418          if (resultSolutions.ContainsKey(result.Key)) {
     419            resultSolutions[result.Key].Add(classificationSolution);
     420          } else {
     421            resultSolutions.Add(result.Key, new List<IClassificationSolution>() { classificationSolution });
     422          }
     423        }
     424      }
     425      var aggregatedResults = new List<IResult>();
     426      foreach (KeyValuePair<string, List<IClassificationSolution>> solutions in resultSolutions) {
     427        var problemDataClone = (IClassificationProblemData)Problem.ProblemData.Clone();
     428        problemDataClone.TrainingPartition.Start = SamplesStart.Value; problemDataClone.TrainingPartition.End = SamplesEnd.Value;
     429        problemDataClone.TestPartition.Start = SamplesStart.Value; problemDataClone.TestPartition.End = SamplesEnd.Value;
     430        var ensembleSolution = new ClassificationEnsembleSolution(solutions.Value.Select(x => x.Model), problemDataClone,
     431          solutions.Value.Select(x => x.ProblemData.TrainingPartition),
     432          solutions.Value.Select(x => x.ProblemData.TestPartition));
     433
     434        aggregatedResults.Add(new Result(solutions.Key + " (ensemble)", ensembleSolution));
     435      }
     436      List<IResult> flattenedResults = new List<IResult>();
     437      CollectResultsRecursively("", aggregatedResults, flattenedResults);
     438      return flattenedResults;
     439    }
     440
     441    private void CollectResultsRecursively(string path, IEnumerable<IResult> results, IList<IResult> flattenedResults) {
     442      foreach (IResult result in results) {
     443        flattenedResults.Add(new Result(path + result.Name, result.Value));
     444        ResultCollection childCollection = result.Value as ResultCollection;
     445        if (childCollection != null) {
     446          CollectResultsRecursively(path + result.Name + ".", childCollection, flattenedResults);
     447        }
     448      }
    406449    }
    407450
     
    428471      foreach (KeyValuePair<string, List<double>> resultValue in resultValues) {
    429472        doubleValue.Value = resultValue.Value.Average();
    430         aggregatedResults.Add(new Result(resultValue.Key, (IItem)doubleValue.Clone()));
     473        aggregatedResults.Add(new Result(resultValue.Key + " (average)", (IItem)doubleValue.Clone()));
    431474        doubleValue.Value = resultValue.Value.StandardDeviation();
    432         aggregatedResults.Add(new Result(resultValue.Key + " StdDev", (IItem)doubleValue.Clone()));
     475        aggregatedResults.Add(new Result(resultValue.Key + " (std.dev.)", (IItem)doubleValue.Clone()));
    433476      }
    434477      return aggregatedResults;
  • branches/histogram/HeuristicLab.Algorithms.DataAnalysis/3.4/HeuristicLab.Algorithms.DataAnalysis-3.4.csproj

    r5809 r6340  
    112112    <Compile Include="HeuristicLabAlgorithmsDataAnalysisPlugin.cs" />
    113113    <Compile Include="FixedDataAnalysisAlgorithm.cs" />
     114    <Compile Include="Interfaces\IRandomForestClassificationSolution.cs" />
     115    <Compile Include="Interfaces\IRandomForestModel.cs" />
     116    <Compile Include="Interfaces\IRandomForestRegressionSolution.cs" />
    114117    <Compile Include="Interfaces\ISupportVectorMachineModel.cs" />
    115118    <Compile Include="Interfaces\ISupportVectorMachineSolution.cs" />
     
    127130    </Compile>
    128131    <Compile Include="Properties\AssemblyInfo.cs" />
     132    <Compile Include="RandomForest\RandomForestClassificationSolution.cs" />
     133    <Compile Include="RandomForest\RandomForestClassification.cs" />
     134    <Compile Include="RandomForest\RandomForestModel.cs" />
     135    <Compile Include="RandomForest\RandomForestRegression.cs" />
     136    <Compile Include="RandomForest\RandomForestRegressionSolution.cs" />
    129137    <Compile Include="SupportVectorMachine\SupportVectorClassification.cs" />
    130138    <Compile Include="SupportVectorMachine\SupportVectorClassificationSolution.cs" />
  • branches/histogram/HeuristicLab.Algorithms.DataAnalysis/3.4/Linear/LinearDiscriminantAnalysis.cs

    r6195 r6340  
    3636  /// Linear discriminant analysis classification algorithm.
    3737  /// </summary>
    38   [Item("Linear Discriminant Analysis", "Linear discriminant analysis classification algorithm.")]
     38  [Item("Linear Discriminant Analysis", "Linear discriminant analysis classification algorithm (wrapper for ALGLIB).")]
    3939  [Creatable("Data Analysis")]
    4040  [StorableClass]
  • branches/histogram/HeuristicLab.Algorithms.DataAnalysis/3.4/Linear/LinearRegression.cs

    r6195 r6340  
    3737  /// Linear regression data analysis algorithm.
    3838  /// </summary>
    39   [Item("Linear Regression", "Linear regression data analysis algorithm.")]
     39  [Item("Linear Regression", "Linear regression data analysis algorithm (wrapper for ALGLIB).")]
    4040  [Creatable("Data Analysis")]
    4141  [StorableClass]
  • branches/histogram/HeuristicLab.Algorithms.DataAnalysis/3.4/SupportVectorMachine/SupportVectorClassification.cs

    r6195 r6340  
    3535  /// Support vector machine classification data analysis algorithm.
    3636  /// </summary>
    37   [Item("Support Vector Classification", "Support vector machine classification data analysis algorithm.")]
     37  [Item("Support Vector Classification", "Support vector machine classification data analysis algorithm (wrapper for libSVM).")]
    3838  [Creatable("Data Analysis")]
    3939  [StorableClass]
  • branches/histogram/HeuristicLab.Algorithms.DataAnalysis/3.4/SupportVectorMachine/SupportVectorRegression.cs

    r6195 r6340  
    3535  /// Support vector machine regression data analysis algorithm.
    3636  /// </summary>
    37   [Item("Support Vector Regression", "Support vector machine regression data analysis algorithm.")]
     37  [Item("Support Vector Regression", "Support vector machine regression data analysis algorithm (wrapper for libSVM).")]
    3838  [Creatable("Data Analysis")]
    3939  [StorableClass]
  • branches/histogram/HeuristicLab.Algorithms.DataAnalysis/3.4/kMeans/KMeansClustering.cs

    r6195 r6340  
    3535  /// k-Means clustering algorithm data analysis algorithm.
    3636  /// </summary>
    37   [Item("k-Means", "The k-Means clustering algorithm.")]
     37  [Item("k-Means", "The k-Means clustering algorithm (wrapper for ALGLIB).")]
    3838  [Creatable("Data Analysis")]
    3939  [StorableClass]
Note: See TracChangeset for help on using the changeset viewer.