- Timestamp:
- 07/27/21 14:43:06 (3 years ago)
- Location:
- trunk/HeuristicLab.Problems.DataAnalysis/3.4
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/DataAnalysisProblemData.cs
r17180 r18034 38 38 protected const string TestPartitionParameterName = "TestPartition"; 39 39 protected const string TransformationsParameterName = "Transformations"; 40 protected const string VariableRangesParameterName = "VariableRanges"; 40 41 41 42 #region parameter properites … … 48 49 } 49 50 } 51 52 public IFixedValueParameter<IntervalCollection> VariableRangesParameter => (IFixedValueParameter<IntervalCollection>)Parameters[VariableRangesParameterName]; 53 public IntervalCollection VariableRanges => VariableRangesParameter.Value; 50 54 51 55 private IFixedValueParameter<ReadOnlyCheckedItemList<StringValue>> inputVariablesParameter; … … 151 155 TransformationsParameter.Hidden = true; 152 156 } 157 if (!Parameters.ContainsKey(VariableRangesParameterName)) { 158 var variableRanges = Dataset.GetVariableRanges(); 159 Parameters.Add(new FixedValueParameter<IntervalCollection>(VariableRangesParameterName, variableRanges)); 160 } 153 161 RegisterEventHandlers(); 154 162 } 155 163 156 protected DataAnalysisProblemData(IDataset dataset, IEnumerable<string> allowedInputVariables, IEnumerable<ITransformation> transformations = null ) {164 protected DataAnalysisProblemData(IDataset dataset, IEnumerable<string> allowedInputVariables, IEnumerable<ITransformation> transformations = null, IntervalCollection variableRanges = null) { 157 165 if (dataset == null) throw new ArgumentNullException("The dataset must not be null."); 158 166 if (allowedInputVariables == null) throw new ArgumentNullException("The allowed input variables must not be null."); … … 178 186 Parameters.Add(new FixedValueParameter<IntRange>(TestPartitionParameterName, "", new IntRange(testPartitionStart, testPartitionEnd))); 179 187 Parameters.Add(new FixedValueParameter<ReadOnlyItemList<ITransformation>>(TransformationsParameterName, "", transformationsList.AsReadOnly())); 188 189 if (variableRanges == null) { 190 variableRanges = Dataset.GetVariableRanges(); 191 } 192 Parameters.Add(new FixedValueParameter<IntervalCollection>(VariableRangesParameterName, variableRanges)); 180 193 181 194 TransformationsParameter.Hidden = true; -
trunk/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionProblemData.cs
r18000 r18034 34 34 public class RegressionProblemData : DataAnalysisProblemData, IRegressionProblemData, IStorableContent { 35 35 protected const string TargetVariableParameterName = "TargetVariable"; 36 protected const string VariableRangesParameterName = "VariableRanges";36 //protected const string VariableRangesParameterName = "VariableRanges"; 37 37 public string Filename { get; set; } 38 38 … … 99 99 #region parameter properties 100 100 public IConstrainedValueParameter<StringValue> TargetVariableParameter => (IConstrainedValueParameter<StringValue>)Parameters[TargetVariableParameterName]; 101 public IFixedValueParameter<IntervalCollection> VariableRangesParameter => (IFixedValueParameter<IntervalCollection>)Parameters[VariableRangesParameterName];101 /*public IFixedValueParameter<IntervalCollection> VariableRangesParameter => (IFixedValueParameter<IntervalCollection>)Parameters[VariableRangesParameterName]; 102 102 #endregion 103 103 … … 105 105 public IntervalCollection VariableRanges { 106 106 get => VariableRangesParameter.Value; 107 } 107 }*/ 108 108 109 109 public string TargetVariable { … … 129 129 [StorableHook(HookType.AfterDeserialization)] 130 130 private void AfterDeserialization() { 131 if (!Parameters.ContainsKey(VariableRangesParameterName)) {131 /*if (!Parameters.ContainsKey(VariableRangesParameterName)) { 132 132 var variableRanges = Dataset.GetVariableRanges(); 133 133 Parameters.Add(new FixedValueParameter<IntervalCollection>(VariableRangesParameterName, variableRanges)); 134 } 134 }*/ 135 135 136 136 RegisterParameterEvents(); … … 158 158 159 159 public RegressionProblemData(IDataset dataset, IEnumerable<string> allowedInputVariables, string targetVariable, 160 IEnumerable<ITransformation> transformations = null ,161 IntervalCollection variableRanges = null )160 IEnumerable<ITransformation> transformations = null/*, 161 IntervalCollection variableRanges = null*/) 162 162 : base(dataset, allowedInputVariables, transformations ?? Enumerable.Empty<ITransformation>()) { 163 163 var variables = InputVariables.Select(x => x.AsReadOnly()).ToList(); 164 164 Parameters.Add(new ConstrainedValueParameter<StringValue>(TargetVariableParameterName, new ItemSet<StringValue>(variables), variables.Where(x => x.Value == targetVariable).First())); 165 if (variableRanges == null) {165 /*if (variableRanges == null) { 166 166 variableRanges = Dataset.GetVariableRanges(); 167 167 } 168 Parameters.Add(new FixedValueParameter<IntervalCollection>(VariableRangesParameterName, variableRanges)); 168 Parameters.Add(new FixedValueParameter<IntervalCollection>(VariableRangesParameterName, variableRanges));*/ 169 169 } 170 170 private void RegisterParameterEvents() { -
trunk/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/ShapeConstrainedRegressionProblemData.cs
r17999 r18034 152 152 IntRange trainingPartition, IntRange testPartition, 153 153 IEnumerable<ITransformation> transformations = null, ShapeConstraints sc = null, IntervalCollection variableRanges = null) 154 : base(dataset, allowedInputVariables, targetVariable, transformations ?? Enumerable.Empty<ITransformation>() , variableRanges) {154 : base(dataset, allowedInputVariables, targetVariable, transformations ?? Enumerable.Empty<ITransformation>()) { 155 155 TrainingPartition.Start = trainingPartition.Start; 156 156 TrainingPartition.End = trainingPartition.End; -
trunk/HeuristicLab.Problems.DataAnalysis/3.4/Interfaces/IDataAnalysisProblemData.cs
r17180 r18034 35 35 IEnumerable<string> AllowedInputVariables { get; } 36 36 37 IntervalCollection VariableRanges { get; } 38 37 39 double[,] AllowedInputsTrainingValues { get; } 38 40 double[,] AllowedInputsTestValues { get; } -
trunk/HeuristicLab.Problems.DataAnalysis/3.4/Interfaces/Regression/IRegressionProblemData.cs
r17958 r18034 29 29 public interface IRegressionProblemData : IDataAnalysisProblemData { 30 30 string TargetVariable { get; set; } 31 IntervalCollection VariableRanges { get; }31 32 32 IEnumerable<double> TargetVariableValues { get; } 33 33 IEnumerable<double> TargetVariableTrainingValues { get; }
Note: See TracChangeset
for help on using the changeset viewer.