Changeset 6685 for branches/GeneralizedQAP/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/ClassificationEnsembleProblemData.cs
- Timestamp:
- 08/31/11 11:52:11 (13 years ago)
- Location:
- branches/GeneralizedQAP
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GeneralizedQAP
- Property svn:mergeinfo changed
/trunk/sources (added) merged: 6648-6649,6652-6656,6661-6674,6676-6681,6684
- Property svn:mergeinfo changed
-
branches/GeneralizedQAP/HeuristicLab.Problems.DataAnalysis
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Problems.DataAnalysis (added) merged: 6653-6654,6661,6666,6672
- Property svn:mergeinfo changed
-
branches/GeneralizedQAP/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/ClassificationEnsembleProblemData.cs
r6520 r6685 20 20 #endregion 21 21 22 using System;23 22 using System.Collections.Generic; 24 using System.IO;25 using System.Linq;26 23 using HeuristicLab.Common; 27 24 using HeuristicLab.Core; … … 35 32 public class ClassificationEnsembleProblemData : ClassificationProblemData { 36 33 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; 41 37 } 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; 46 64 } 47 65 48 66 [StorableConstructor] 49 67 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 } 50 73 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() { } 56 75 public ClassificationEnsembleProblemData(IClassificationProblemData classificationProblemData) 57 76 : base(classificationProblemData.Dataset, classificationProblemData.AllowedInputVariables, classificationProblemData.TargetVariable) { … … 61 80 this.TestPartition.End = classificationProblemData.TestPartition.End; 62 81 } 82 83 public ClassificationEnsembleProblemData(Dataset dataset, IEnumerable<string> allowedInputVariables, string targetVariable) 84 : base(dataset, allowedInputVariables, targetVariable) { 85 } 63 86 } 64 87 }
Note: See TracChangeset
for help on using the changeset viewer.