Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/31/11 11:52:11 (13 years ago)
Author:
abeham
Message:

#1628

  • Updated branch from trunk
  • Changed ReferenceEqualityComparer<T> to become a non-generic class (generic implementation probably was only made because of lacking support for co- and contravariance in C# 3.5)
  • Added finished experiment from sample algorithms to the tests
  • Wrote a unit test to instantiate every IDeepCloneable type, clone it and compare the objects in the object graph for equal references
  • Wrote a unit test to load the experiment, clone it and compare again the objects in the object graph
  • Preliminary fix for a potential bug in ThreadSafeLog
  • Preliminary fix for a potential bug in OperatorGraphVisualizationInfo
  • Preliminary fix for a potential bug in Calculator (and added license headers)
  • Preliminary fix for a potential bug in ScrambleMove
Location:
branches/GeneralizedQAP
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/GeneralizedQAP

  • branches/GeneralizedQAP/HeuristicLab.Problems.DataAnalysis

  • branches/GeneralizedQAP/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionEnsembleProblemData.cs

    r6238 r6685  
    2020#endregion
    2121
    22 using System;
    2322using System.Collections.Generic;
    24 using System.IO;
    25 using System.Linq;
    2623using HeuristicLab.Common;
    2724using HeuristicLab.Core;
     
    3532  public sealed class RegressionEnsembleProblemData : RegressionProblemData {
    3633
    37     public override IEnumerable<int> TrainingIndizes {
    38       get {
    39         return Enumerable.Range(TrainingPartition.Start, TrainingPartition.End - TrainingPartition.Start);
    40       }
     34    public override bool IsTrainingSample(int index) {
     35      return index >= 0 && index < Dataset.Rows &&
     36             TrainingPartition.Start <= index && index < TrainingPartition.End;
    4137    }
    4238
    43     public override IEnumerable<int> TestIndizes {
    44       get {
    45         return Enumerable.Range(TestPartition.Start, TestPartition.End - TestPartition.Start);
    46       }
     39    public override bool IsTestSample(int index) {
     40      return index >= 0 && index < Dataset.Rows &&
     41             TestPartition.Start <= index && index < TestPartition.End;
     42    }
     43
     44    private static readonly RegressionEnsembleProblemData emptyProblemData;
     45    public new static RegressionEnsembleProblemData EmptyProblemData {
     46      get { return emptyProblemData; }
     47    }
     48    static RegressionEnsembleProblemData() {
     49      var problemData = new RegressionEnsembleProblemData();
     50      problemData.Parameters.Clear();
     51      problemData.Name = "Empty Regression ProblemData";
     52      problemData.Description = "This ProblemData acts as place holder before the correct problem data is loaded.";
     53      problemData.isEmpty = true;
     54
     55      problemData.Parameters.Add(new FixedValueParameter<Dataset>(DatasetParameterName, "", new Dataset()));
     56      problemData.Parameters.Add(new FixedValueParameter<ReadOnlyCheckedItemList<StringValue>>(InputVariablesParameterName, ""));
     57      problemData.Parameters.Add(new FixedValueParameter<IntRange>(TrainingPartitionParameterName, "", (IntRange)new IntRange(0, 0).AsReadOnly()));
     58      problemData.Parameters.Add(new FixedValueParameter<IntRange>(TestPartitionParameterName, "", (IntRange)new IntRange(0, 0).AsReadOnly()));
     59      problemData.Parameters.Add(new ConstrainedValueParameter<StringValue>(TargetVariableParameterName, new ItemSet<StringValue>()));
     60      emptyProblemData = problemData;
    4761    }
    4862
    4963    [StorableConstructor]
    5064    private RegressionEnsembleProblemData(bool deserializing) : base(deserializing) { }
     65    private RegressionEnsembleProblemData(RegressionEnsembleProblemData original, Cloner cloner) : base(original, cloner) { }
     66    public override IDeepCloneable Clone(Cloner cloner) {
     67      if (this == emptyProblemData) return emptyProblemData;
     68      return new RegressionEnsembleProblemData(this, cloner);
     69    }
    5170
    52     private RegressionEnsembleProblemData(RegressionEnsembleProblemData original, Cloner cloner)
    53       : base(original, cloner) {
    54     }
    55     public override IDeepCloneable Clone(Cloner cloner) { return new RegressionEnsembleProblemData(this, cloner); }
    56 
     71    public RegressionEnsembleProblemData() : base() { }
    5772    public RegressionEnsembleProblemData(IRegressionProblemData regressionProblemData)
    5873      : base(regressionProblemData.Dataset, regressionProblemData.AllowedInputVariables, regressionProblemData.TargetVariable) {
     
    6277      TestPartition.End = regressionProblemData.TestPartition.End;
    6378    }
     79    public RegressionEnsembleProblemData(Dataset dataset, IEnumerable<string> allowedInputVariables, string targetVariable)
     80      : base(dataset, allowedInputVariables, targetVariable) {
     81    }
    6482  }
    6583}
Note: See TracChangeset for help on using the changeset viewer.