Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/17/11 14:37:34 (13 years ago)
Author:
mkommend
Message:

#1592: Enabled creation of empty ensemble solutions and problem data changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/ClassificationEnsembleProblemData.cs

    r6520 r6666  
    2020#endregion
    2121
    22 using System;
    2322using System.Collections.Generic;
    24 using System.IO;
    2523using System.Linq;
    2624using HeuristicLab.Common;
     
    3634
    3735    public override IEnumerable<int> TrainingIndizes {
    38       get {
    39         return Enumerable.Range(TrainingPartition.Start, TrainingPartition.End - TrainingPartition.Start);
    40       }
     36      get { return Enumerable.Range(TrainingPartition.Start, TrainingPartition.End - TrainingPartition.Start); }
    4137    }
    4238    public override IEnumerable<int> TestIndizes {
    43       get {
    44         return Enumerable.Range(TestPartition.Start, TestPartition.End - TestPartition.Start);
    45       }
     39      get { return Enumerable.Range(TestPartition.Start, TestPartition.End - TestPartition.Start); }
     40    }
     41
     42    private static ClassificationEnsembleProblemData emptyProblemData;
     43    public static ClassificationEnsembleProblemData EmptyProblemData {
     44      get { return emptyProblemData; }
     45    }
     46
     47    static ClassificationEnsembleProblemData() {
     48      var problemData = new ClassificationEnsembleProblemData();
     49      problemData.Parameters.Clear();
     50      problemData.Name = "Empty Classification ProblemData";
     51      problemData.Description = "This ProblemData acts as place holder before the correct problem data is loaded.";
     52      problemData.isEmpty = true;
     53
     54      problemData.Parameters.Add(new FixedValueParameter<Dataset>(DatasetParameterName, "", new Dataset()));
     55      problemData.Parameters.Add(new FixedValueParameter<ReadOnlyCheckedItemList<StringValue>>(InputVariablesParameterName, ""));
     56      problemData.Parameters.Add(new FixedValueParameter<IntRange>(TrainingPartitionParameterName, "", (IntRange)new IntRange(0, 0).AsReadOnly()));
     57      problemData.Parameters.Add(new FixedValueParameter<IntRange>(TestPartitionParameterName, "", (IntRange)new IntRange(0, 0).AsReadOnly()));
     58      problemData.Parameters.Add(new ConstrainedValueParameter<StringValue>(TargetVariableParameterName, new ItemSet<StringValue>()));
     59      problemData.Parameters.Add(new FixedValueParameter<StringMatrix>(ClassNamesParameterName, "", new StringMatrix(0, 0).AsReadOnly()));
     60      problemData.Parameters.Add(new FixedValueParameter<DoubleMatrix>(ClassificationPenaltiesParameterName, "", (DoubleMatrix)new DoubleMatrix(0, 0).AsReadOnly()));
     61      emptyProblemData = problemData;
    4662    }
    4763
    4864    [StorableConstructor]
    4965    protected ClassificationEnsembleProblemData(bool deserializing) : base(deserializing) { }
     66    protected ClassificationEnsembleProblemData(ClassificationEnsembleProblemData original, Cloner cloner) : base(original, cloner) { }
     67    public override IDeepCloneable Clone(Cloner cloner) {
     68      if (this == emptyProblemData) return emptyProblemData;
     69      return new ClassificationEnsembleProblemData(this, cloner);
     70    }
    5071
    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 
     72    public ClassificationEnsembleProblemData() : base() { }
    5673    public ClassificationEnsembleProblemData(IClassificationProblemData classificationProblemData)
    5774      : base(classificationProblemData.Dataset, classificationProblemData.AllowedInputVariables, classificationProblemData.TargetVariable) {
     
    6178      this.TestPartition.End = classificationProblemData.TestPartition.End;
    6279    }
     80
     81    public ClassificationEnsembleProblemData(Dataset dataset, IEnumerable<string> allowedInputVariables, string targetVariable)
     82      : base(dataset, allowedInputVariables, targetVariable) {
     83    }
    6384  }
    6485}
Note: See TracChangeset for help on using the changeset viewer.