Free cookie consent management tool by TermsFeed Policy Generator

source: branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/RegressionProblemDataConverter.cs @ 17406

Last change on this file since 17406 was 17406, checked in by dpiringe, 4 years ago

#3026

  • added interfaces IJsonItem and IJsonItemValidator
  • replaced every reference JsonItem with IJsonItem
File size: 1.7 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Reflection;
5using System.Text;
6using System.Threading.Tasks;
7using HeuristicLab.Core;
8using HeuristicLab.Data;
9
10namespace HeuristicLab.JsonInterface {
11  public class RegressionProblemDataConverter : BaseConverter {
12    private const BindingFlags flags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance;
13    public override int Priority => 20;
14    public override Type ConvertableType => HEAL.Attic.Mapper.StaticCache.GetType(new Guid("EE612297-B1AF-42D2-BF21-AF9A2D42791C"));
15
16    public override void Populate(IItem value, IJsonItem item, IJsonItemConverter root) {     
17      dynamic val = (dynamic)value;
18      object dataset = (object)val.Dataset;
19      dynamic targetVariable = val.TargetVariable;
20      FieldInfo dataInfo = dataset.GetType().GetField("storableData", flags);
21      // TODO: aufteilen in trainings und test daten abschnitte
22      item.AddChilds(new JsonItem() {
23        Name = "Dataset",
24        Value = dataInfo.GetValue(dataset)
25      });
26
27      IEnumerable<StringValue> variables = (IEnumerable<StringValue>)val.InputVariables;
28      item.AddChilds(new JsonItem() {
29        Name = "TargetVariable",
30        Value = (object)targetVariable,
31        Range = variables.Select(x => x.Value)
32      });
33
34
35      item.AddChilds(new JsonItem() {
36        Name = "AllowedInputVariables",
37        Value = (object)val.AllowedInputVariables,
38        Range = variables.Select(x => x.Value)
39      });
40    }
41
42    public override void InjectData(IItem item, IJsonItem data, IJsonItemConverter root) {
43      // TODO: inject data
44      throw new NotImplementedException();
45    }
46  }
47}
Note: See TracBrowser for help on using the repository browser.