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/Classification/ClassificationEnsembleProblemData.cs

    r6520 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 class ClassificationEnsembleProblemData : ClassificationProblemData {
    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    }
    42     public override IEnumerable<int> TestIndizes {
    43       get {
    44         return Enumerable.Range(TestPartition.Start, TestPartition.End - TestPartition.Start);
    45       }
     38
     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 ClassificationEnsembleProblemData emptyProblemData;
     45    public static ClassificationEnsembleProblemData EmptyProblemData {
     46      get { return emptyProblemData; }
     47    }
     48
     49    static ClassificationEnsembleProblemData() {
     50      var problemData = new ClassificationEnsembleProblemData();
     51      problemData.Parameters.Clear();
     52      problemData.Name = "Empty Classification ProblemData";
     53      problemData.Description = "This ProblemData acts as place holder before the correct problem data is loaded.";
     54      problemData.isEmpty = true;
     55
     56      problemData.Parameters.Add(new FixedValueParameter<Dataset>(DatasetParameterName, "", new Dataset()));
     57      problemData.Parameters.Add(new FixedValueParameter<ReadOnlyCheckedItemList<StringValue>>(InputVariablesParameterName, ""));
     58      problemData.Parameters.Add(new FixedValueParameter<IntRange>(TrainingPartitionParameterName, "", (IntRange)new IntRange(0, 0).AsReadOnly()));
     59      problemData.Parameters.Add(new FixedValueParameter<IntRange>(TestPartitionParameterName, "", (IntRange)new IntRange(0, 0).AsReadOnly()));
     60      problemData.Parameters.Add(new ConstrainedValueParameter<StringValue>(TargetVariableParameterName, new ItemSet<StringValue>()));
     61      problemData.Parameters.Add(new FixedValueParameter<StringMatrix>(ClassNamesParameterName, "", new StringMatrix(0, 0).AsReadOnly()));
     62      problemData.Parameters.Add(new FixedValueParameter<DoubleMatrix>(ClassificationPenaltiesParameterName, "", (DoubleMatrix)new DoubleMatrix(0, 0).AsReadOnly()));
     63      emptyProblemData = problemData;
    4664    }
    4765
    4866    [StorableConstructor]
    4967    protected ClassificationEnsembleProblemData(bool deserializing) : base(deserializing) { }
     68    protected ClassificationEnsembleProblemData(ClassificationEnsembleProblemData original, Cloner cloner) : base(original, cloner) { }
     69    public override IDeepCloneable Clone(Cloner cloner) {
     70      if (this == emptyProblemData) return emptyProblemData;
     71      return new ClassificationEnsembleProblemData(this, cloner);
     72    }
    5073
    51     protected ClassificationEnsembleProblemData(ClassificationEnsembleProblemData original, Cloner cloner)
    52       : base(original, cloner) {
    53     }
    54     public override IDeepCloneable Clone(Cloner cloner) { return new ClassificationEnsembleProblemData(this, cloner); }
    55 
     74    public ClassificationEnsembleProblemData() : base() { }
    5675    public ClassificationEnsembleProblemData(IClassificationProblemData classificationProblemData)
    5776      : base(classificationProblemData.Dataset, classificationProblemData.AllowedInputVariables, classificationProblemData.TargetVariable) {
     
    6180      this.TestPartition.End = classificationProblemData.TestPartition.End;
    6281    }
     82
     83    public ClassificationEnsembleProblemData(Dataset dataset, IEnumerable<string> allowedInputVariables, string targetVariable)
     84      : base(dataset, allowedInputVariables, targetVariable) {
     85    }
    6386  }
    6487}
Note: See TracChangeset for help on using the changeset viewer.