Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/11/11 15:03:46 (14 years ago)
Author:
gkronber
Message:

Merged changes from trunk to data analysis exploration branch and added fractional distance metric evaluator. #1142

Location:
branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/SupportVectorMachine/ParameterAdjustmentProblem
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/SupportVectorMachine/ParameterAdjustmentProblem/SupportVectorMachineParameterAdjustmentBestSolutionAnalyzer.cs

    r4068 r5275  
    3030using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    3131using HeuristicLab.Problems.DataAnalysis.Evaluators;
     32using HeuristicLab.Common;
    3233
    3334namespace HeuristicLab.Problems.DataAnalysis.SupportVectorMachine.ParameterAdjustmentProblem {
     
    8990
    9091    #endregion
    91 
     92    [StorableConstructor]
     93    protected SupportVectorMachineParameterAdjustmentBestSolutionAnalyzer(bool deserializing) : base(deserializing) { }
     94    protected SupportVectorMachineParameterAdjustmentBestSolutionAnalyzer(SupportVectorMachineParameterAdjustmentBestSolutionAnalyzer original, Cloner cloner)
     95      : base(original, cloner) {
     96    }
    9297    public SupportVectorMachineParameterAdjustmentBestSolutionAnalyzer()
    9398      : base() {
     
    103108      Parameters.Add(new LookupParameter<ResultCollection>(ResultsParameterName, "The result collection where the best support vector solution should be stored."));
    104109    }
    105 
     110    public override IDeepCloneable Clone(Cloner cloner) {
     111      return new SupportVectorMachineParameterAdjustmentBestSolutionAnalyzer(this, cloner);
     112    }
    106113    public override IOperation Apply() {
    107114      var points = ParameterVectorParameter.ActualValue;
     
    124131      if (bestModel == null) {
    125132        bestModel = SupportVectorMachineModelCreator.TrainModel(DataAnalysisProblemData,
    126           DataAnalysisProblemData.TrainingSamplesStart.Value, DataAnalysisProblemData.TrainingSamplesEnd.Value,
     133          DataAnalysisProblemData.TrainingIndizes,
    127134          SvmType.Value, KernelType.Value, cost, nu, gamma, 0.0);
    128135        BestSolutionParameter.ActualValue = bestModel;
     
    153160        if (BestSolutionQualityParameter.ActualValue.Value > bestQuality) {
    154161          bestModel = SupportVectorMachineModelCreator.TrainModel(DataAnalysisProblemData,
    155             DataAnalysisProblemData.TrainingSamplesStart.Value, DataAnalysisProblemData.TrainingSamplesEnd.Value,
     162            DataAnalysisProblemData.TrainingIndizes,
    156163            SvmType.Value, KernelType.Value, cost, nu, gamma, 0.0);
    157164          BestSolutionParameter.ActualValue = bestModel;
  • branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/SupportVectorMachine/ParameterAdjustmentProblem/SupportVectorMachineParameterAdjustmentEvaluator.cs

    r4068 r5275  
    2828using HeuristicLab.Parameters;
    2929using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     30using HeuristicLab.Common;
    3031
    3132namespace HeuristicLab.Problems.DataAnalysis.SupportVectorMachine.ParameterAdjustmentProblem {
     
    107108    }
    108109    #endregion
    109 
     110    [StorableConstructor]
     111    protected SupportVectorMachineParameterAdjustmentEvaluator(bool deserializing) : base(deserializing) { }
     112    protected SupportVectorMachineParameterAdjustmentEvaluator(SupportVectorMachineParameterAdjustmentEvaluator original, Cloner cloner)
     113      : base(original, cloner) {
     114    }
    110115    public SupportVectorMachineParameterAdjustmentEvaluator()
    111116      : base() {
     
    130135      evaluator.Successor = null;
    131136    }
     137    public override IDeepCloneable Clone(Cloner cloner) {
     138      return new SupportVectorMachineParameterAdjustmentEvaluator(this, cloner);
     139    }
    132140
    133141    public override IOperation Apply() {
  • branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/SupportVectorMachine/ParameterAdjustmentProblem/SupportVectorMachineParameterAdjustmentProblem.cs

    r4118 r5275  
    130130    [StorableConstructor]
    131131    private SupportVectorMachineParameterAdjustmentProblem(bool deserializing) : base(deserializing) { }
     132    private SupportVectorMachineParameterAdjustmentProblem(SupportVectorMachineParameterAdjustmentProblem original, Cloner cloner)
     133      : base(original, cloner) {
     134      operators = original.operators.Where(x => IsNotFieldReferenced(x)).Select(x => (IOperator)cloner.Clone(x)).ToList();
     135      strategyVectorCreator = (StdDevStrategyVectorCreator)cloner.Clone(original.strategyVectorCreator);
     136      operators.Add(strategyVectorCreator);
     137      strategyVectorCrossover = (StdDevStrategyVectorCrossover)cloner.Clone(original.strategyVectorCrossover);
     138      operators.Add(strategyVectorCrossover);
     139      strategyVectorManipulator = (StdDevStrategyVectorManipulator)cloner.Clone(original.strategyVectorManipulator);
     140      operators.Add(strategyVectorManipulator);
     141      AttachEventHandlers();
     142    }
    132143    public SupportVectorMachineParameterAdjustmentProblem()
    133144      : base() {
     
    167178
    168179    public override IDeepCloneable Clone(Cloner cloner) {
    169       SupportVectorMachineParameterAdjustmentProblem clone = (SupportVectorMachineParameterAdjustmentProblem)base.Clone(cloner);
    170       clone.operators = operators.Where(x => IsNotFieldReferenced(x)).Select(x => (IOperator)cloner.Clone(x)).ToList();
    171       clone.strategyVectorCreator = (StdDevStrategyVectorCreator)cloner.Clone(strategyVectorCreator);
    172       clone.operators.Add(clone.strategyVectorCreator);
    173       clone.strategyVectorCrossover = (StdDevStrategyVectorCrossover)cloner.Clone(strategyVectorCrossover);
    174       clone.operators.Add(strategyVectorCrossover);
    175       clone.strategyVectorManipulator = (StdDevStrategyVectorManipulator)cloner.Clone(strategyVectorManipulator);
    176       clone.operators.Add(strategyVectorManipulator);
    177       clone.AttachEventHandlers();
    178       return clone;
    179     }
    180 
     180      return new SupportVectorMachineParameterAdjustmentProblem(this, cloner);
     181    }
    181182    private bool IsNotFieldReferenced(IOperator x) {
    182183      return !(x == strategyVectorCreator
Note: See TracChangeset for help on using the changeset viewer.