Changeset 18031
- Timestamp:
- 07/26/21 17:59:15 (3 years ago)
- Location:
- branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/RegressionProblemDataConverter.cs
r17843 r18031 9 9 using HeuristicLab.Data; 10 10 using HeuristicLab.Parameters; 11 using HeuristicLab.Problems.DataAnalysis; 11 12 using Newtonsoft.Json.Linq; 12 13 … … 23 24 private const string VariableNames = "variableNames"; 24 25 private const string InputVariables = "InputVariables"; 26 private const string VariableRanges = "VariableRanges"; 25 27 private const string Rows = "rows"; 26 28 private const string Value = "value"; … … 78 80 SetTestPartition(regressionProblemData, testPartition); 79 81 SetTrainingPartition(regressionProblemData, trainingPartition); 80 82 SetVariableRanges(regressionProblemData, dataset); 81 83 } 82 84 … … 166 168 } 167 169 } 170 } 171 172 private void SetVariableRanges(dynamic regressionProblemData, DoubleMatrixJsonItem item) { 173 // TODO 174 if (item != null) { 175 object variableRanges = (object)regressionProblemData.VariableRanges; //IRegressionProblemData.cs 176 IntervalCollection collection = new IntervalCollection(); 177 int count = 0; 178 foreach (var column in item.ColumnNames) { 179 collection.AddInterval(column, new Interval(item.Value[count].Min(), item.Value[count].Max())); 180 count++; 181 } 182 183 var variableRangesInfo = regressionProblemData.GetType().GetField(VariableRanges, flags); 184 variableRangesInfo.SetValue(regressionProblemData, collection); 185 } 186 } 187 188 private void SetShapeConstraints() { 189 // TODO 168 190 } 169 191 #endregion -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/JsonItems/RangedJsonItem.cs
r17519 r18031 1 1 using System; 2 2 using System.Collections.Generic; 3 using Newtonsoft.Json.Linq; 3 4 4 5 namespace HeuristicLab.JsonInterface { 5 public abstract class RangedJsonItem<T> : JsonItem, IRangedJsonItem<T>6 public abstract class RangedJsonItem<T> : IntervalRestrictedValueJsonItem<T>, IRangedJsonItem<T> 6 7 where T : IComparable { 7 8 public T MinValue { get; set; } 8 9 public T MaxValue { get; set; } 9 public T Minimum { get; set; }10 public T Maximum { get; set; }11 10 12 11 protected override ValidationResult Validate() { … … 19 18 20 19 } 21 20 21 public override void SetJObject(JObject jObject) { 22 var minValueProp = jObject[nameof(IRangedJsonItem<T>.MinValue)]; 23 if (minValueProp != null) MinValue = minValueProp.ToObject<T>(); 24 25 var maxValueProp = jObject[nameof(IRangedJsonItem<T>.MaxValue)]; 26 if (maxValueProp != null) MaxValue = maxValueProp.ToObject<T>(); 27 28 base.SetJObject(jObject); 29 } 30 22 31 } 23 32 }
Note: See TracChangeset
for help on using the changeset viewer.