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/ClassificationProblemData.cs

    r6654 r6666  
    3434  [Item("ClassificationProblemData", "Represents an item containing all data defining a classification problem.")]
    3535  public class ClassificationProblemData : DataAnalysisProblemData, IClassificationProblemData {
    36     private const string TargetVariableParameterName = "TargetVariable";
    37     private const string ClassNamesParameterName = "ClassNames";
    38     private const string ClassificationPenaltiesParameterName = "ClassificationPenalties";
    39     private const int MaximumNumberOfClasses = 20;
    40     private const int InspectedRowsToDetermineTargets = 500;
     36    protected const string TargetVariableParameterName = "TargetVariable";
     37    protected const string ClassNamesParameterName = "ClassNames";
     38    protected const string ClassificationPenaltiesParameterName = "ClassificationPenalties";
     39    protected const int MaximumNumberOfClasses = 20;
     40    protected const int InspectedRowsToDetermineTargets = 500;
    4141
    4242    #region default data
     
    174174    private static IEnumerable<string> defaultAllowedInputVariables;
    175175    private static string defaultTargetVariable;
     176
     177    private static ClassificationProblemData emptyProblemData;
     178    public static ClassificationProblemData EmptyProblemData {
     179      get { return EmptyProblemData; }
     180    }
     181
    176182    static ClassificationProblemData() {
    177183      defaultDataset = new Dataset(defaultVariableNames, defaultData);
     
    181187      defaultAllowedInputVariables = defaultVariableNames.Except(new List<string>() { "sample", "class" });
    182188      defaultTargetVariable = "class";
     189
     190      var problemData = new ClassificationProblemData();
     191      problemData.Parameters.Clear();
     192      problemData.Name = "Empty Classification ProblemData";
     193      problemData.Description = "This ProblemData acts as place holder before the correct problem data is loaded.";
     194      problemData.isEmpty = true;
     195
     196      problemData.Parameters.Add(new FixedValueParameter<Dataset>(DatasetParameterName, "", new Dataset()));
     197      problemData.Parameters.Add(new FixedValueParameter<ReadOnlyCheckedItemList<StringValue>>(InputVariablesParameterName, ""));
     198      problemData.Parameters.Add(new FixedValueParameter<IntRange>(TrainingPartitionParameterName, "", (IntRange)new IntRange(0, 0).AsReadOnly()));
     199      problemData.Parameters.Add(new FixedValueParameter<IntRange>(TestPartitionParameterName, "", (IntRange)new IntRange(0, 0).AsReadOnly()));
     200      problemData.Parameters.Add(new ConstrainedValueParameter<StringValue>(TargetVariableParameterName, new ItemSet<StringValue>()));
     201      problemData.Parameters.Add(new FixedValueParameter<StringMatrix>(ClassNamesParameterName, "", new StringMatrix(0, 0).AsReadOnly()));
     202      problemData.Parameters.Add(new FixedValueParameter<DoubleMatrix>(ClassificationPenaltiesParameterName, "", (DoubleMatrix)new DoubleMatrix(0, 0).AsReadOnly()));
     203      emptyProblemData = problemData;
    183204    }
    184205    #endregion
     
    249270      RegisterParameterEvents();
    250271    }
    251     public override IDeepCloneable Clone(Cloner cloner) { return new ClassificationProblemData(this, cloner); }
     272    public override IDeepCloneable Clone(Cloner cloner) {
     273      if (this == emptyProblemData) return emptyProblemData;
     274      return new ClassificationProblemData(this, cloner);
     275    }
    252276
    253277    public ClassificationProblemData() : this(defaultDataset, defaultAllowedInputVariables, defaultTargetVariable) { }
Note: See TracChangeset for help on using the changeset viewer.