Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/07/12 16:50:35 (13 years ago)
Author:
sforsten
Message:

#1776:

  • selection of a voting strategy is now possible
  • a more sophisticated strategy as discussed with gkronber will be implemented soon
Location:
branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/HeuristicLab.Problems.DataAnalysis-3.4.csproj

    r7459 r7464  
    129129    <Compile Include="Implementation\Classification\DiscriminantFunctionClassificationSolutionBase.cs" />
    130130    <Compile Include="Implementation\Classification\WeightCalculators\AccuracyWeightCalculator.cs" />
     131    <Compile Include="Implementation\Classification\WeightCalculators\AdaBoostWeightCalculator.cs" />
    131132    <Compile Include="Implementation\Classification\WeightCalculators\MajorityVoteWeightCalculator.cs" />
    132133    <Compile Include="Implementation\Classification\WeightCalculators\WeightCalculator.cs" />
  • branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/ClassificationEnsembleSolution.cs

    r7459 r7464  
    5151    }
    5252
     53    public IEnumerable<double> Weights {
     54      get { return new List<double>(weights); }
     55    }
     56
    5357    [Storable]
    5458    private Dictionary<IClassificationModel, IntRange> trainingPartitions;
     
    5660    private Dictionary<IClassificationModel, IntRange> testPartitions;
    5761
     62    private IEnumerable<double> weights;
     63
    5864    private IClassificationEnsembleSolutionWeightCalculator weightCalculator;
     65
     66    public IClassificationEnsembleSolutionWeightCalculator WeightCalculator {
     67      set {
     68        if (value != null) {
     69          weightCalculator = value;
     70          weights = weights = weightCalculator.CalculateWeights(classificationSolutions);
     71          if (!ProblemData.IsEmpty)
     72            RecalculateResults();
     73        }
     74      }
     75    }
    5976
    6077    [StorableConstructor]
     
    98115      classificationSolutions = new ItemCollection<IClassificationSolution>();
    99116
    100       weightCalculator = new AccuracyWeightCalculator();
     117      weightCalculator = new MajorityVoteWeightCalculator();
    101118
    102119      RegisterClassificationSolutionsEventHandler();
     
    158175                                         .ToList();
    159176        var rowsEnumerator = rows.GetEnumerator();
    160         IEnumerable<double> weights = weightCalculator.CalculateWeights(classificationSolutions);
    161177        // aggregate to make sure that MoveNext is called for all enumerators
    162178        while (rowsEnumerator.MoveNext() & estimatedValuesEnumerators.Select(en => en.EstimatedValuesEnumerator.MoveNext()).Aggregate(true, (acc, b) => acc & b)) {
     
    178194                                         .ToList();
    179195        var rowsEnumerator = ProblemData.TestIndizes.GetEnumerator();
    180         IEnumerable<double> weights = weightCalculator.CalculateWeights(classificationSolutions);
    181196        // aggregate to make sure that MoveNext is called for all enumerators
    182197        while (rowsEnumerator.MoveNext() & estimatedValuesEnumerators.Select(en => en.EstimatedValuesEnumerator.MoveNext()).Aggregate(true, (acc, b) => acc & b)) {
     
    203218
    204219    public override IEnumerable<double> GetEstimatedClassValues(IEnumerable<int> rows) {
    205       IEnumerable<double> weights = weightCalculator.CalculateWeights(classificationSolutions);
    206220      return from xs in GetEstimatedClassValueVectors(ProblemData.Dataset, rows)
    207221             select AggregateEstimatedClassValues(xs, weights);
     
    302316      trainingPartitions[solution.Model] = solution.ProblemData.TrainingPartition;
    303317      testPartitions[solution.Model] = solution.ProblemData.TestPartition;
     318      weights = weightCalculator.CalculateWeights(classificationSolutions);
    304319    }
    305320
     
    309324      trainingPartitions.Remove(solution.Model);
    310325      testPartitions.Remove(solution.Model);
     326      weights = weightCalculator.CalculateWeights(classificationSolutions);
    311327    }
    312328  }
  • branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/WeightCalculators/AccuracyWeightCalculator.cs

    r7459 r7464  
    2828namespace HeuristicLab.Problems.DataAnalysis {
    2929  /// <summary>
    30   /// Represents a weight calculator that gives every classification solution a weight based on the accuracy..
     30  /// Represents a weight calculator that gives every classification solution a weight based on the accuracy.
    3131  /// </summary>
    3232  [StorableClass]
  • branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/Interfaces/Classification/IClassificationEnsembleSolutionWeightCalculator.cs

    r7459 r7464  
    2424
    2525namespace HeuristicLab.Problems.DataAnalysis.Interfaces.Classification {
    26   public interface IClassificationEnsembleSolutionWeightCalculator {
     26  public interface IClassificationEnsembleSolutionWeightCalculator : INamedItem {
    2727    IEnumerable<double> CalculateWeights(ItemCollection<IClassificationSolution> classificationSolutions);
    2828  }
Note: See TracChangeset for help on using the changeset viewer.