Changeset 6685 for branches/GeneralizedQAP/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionEnsembleProblemData.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/Regression/RegressionEnsembleProblemData.cs
r6238 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 sealed class RegressionEnsembleProblemData : RegressionProblemData { 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 38 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; 47 61 } 48 62 49 63 [StorableConstructor] 50 64 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 } 51 70 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() { } 57 72 public RegressionEnsembleProblemData(IRegressionProblemData regressionProblemData) 58 73 : base(regressionProblemData.Dataset, regressionProblemData.AllowedInputVariables, regressionProblemData.TargetVariable) { … … 62 77 TestPartition.End = regressionProblemData.TestPartition.End; 63 78 } 79 public RegressionEnsembleProblemData(Dataset dataset, IEnumerable<string> allowedInputVariables, string targetVariable) 80 : base(dataset, allowedInputVariables, targetVariable) { 81 } 64 82 } 65 83 }
Note: See TracChangeset
for help on using the changeset viewer.