Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/22/17 16:52:36 (8 years ago)
Author:
abeham
Message:

#2457: working on MemPR integration

Location:
branches/PerformanceComparison/HeuristicLab.Algorithms.MemPR/3.3/Binary/SolutionModel/Univariate
Files:
1 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • branches/PerformanceComparison/HeuristicLab.Algorithms.MemPR/3.3/Binary/SolutionModel/Univariate/BiasedModelTrainer.cs

    r14563 r14776  
    2626using HeuristicLab.Data;
    2727using HeuristicLab.Encodings.BinaryVectorEncoding;
     28using HeuristicLab.Encodings.BinaryVectorEncoding.SolutionModel;
    2829using HeuristicLab.Optimization;
    2930using HeuristicLab.Parameters;
     
    3132
    3233namespace HeuristicLab.Algorithms.MemPR.Binary.SolutionModel.Univariate {
     34  public enum ModelBiasOptions { Rank, Fitness }
     35
    3336  [Item("Biased Univariate Model Trainer (binary)", "", ExcludeGenericTypeInfo = true)]
    3437  [StorableClass]
     
    6063
    6164    public void TrainModel(TContext context) {
    62       context.Model = Trainer.TrainBiased(ModelBias, context.Random, context.Maximization, context.Population.Select(x => x.Solution), context.Population.Select(x => x.Fitness));
     65      var biasType = modelBiasParameter.Value.Value;
     66      switch (biasType) {
     67        case ModelBiasOptions.Fitness:
     68          context.Model = UnivariateModelTrainer.TrainWithFitnessBias(context.Random, context.Maximization,
     69            context.Population.Select(x => x.Solution),
     70            context.Population.Select(x => x.Fitness));
     71          break;
     72        case ModelBiasOptions.Rank:
     73          context.Model = UnivariateModelTrainer.TrainWithRankBias(context.Random, context.Maximization,
     74            context.Population.Select(x => x.Solution),
     75            context.Population.Select(x => x.Fitness));
     76          break;
     77      }
    6378    }
    6479  }
  • branches/PerformanceComparison/HeuristicLab.Algorithms.MemPR/3.3/Binary/SolutionModel/Univariate/UnbiasedModelTrainer.cs

    r14563 r14776  
    2525using HeuristicLab.Core;
    2626using HeuristicLab.Encodings.BinaryVectorEncoding;
     27using HeuristicLab.Encodings.BinaryVectorEncoding.SolutionModel;
    2728using HeuristicLab.Optimization;
    2829using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     
    4950
    5051    public void TrainModel(TContext context) {
    51       context.Model = Trainer.TrainUnbiased(context.Random, context.Population.Select(x => x.Solution));
     52      context.Model = UnivariateModelTrainer.TrainUnbiased(context.Random, context.Population.Select(x => x.Solution));
    5253    }
    5354  }
Note: See TracChangeset for help on using the changeset viewer.