Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/04/21 17:04:01 (2 years ago)
Author:
dpiringe
Message:

#3026

  • added the dockerhub readme file
  • fixed a bug which caused changed values (changed by events) to be overwritten with wrong values
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/RegressionProblemDataConverter.cs

    r18057 r18077  
    2222
    2323    public override void Inject(IItem item, IJsonItem data, IJsonItemConverter root) {
     24      if (data.Children.All(x => !x.Active))
     25        return;
     26
    2427      var parameter = item as ValueParameter<IRegressionProblemData>;
    2528
    26       DoubleMatrixJsonItem dataset = null;
    27       StringJsonItem targetVariable = null;
    28       IntRangeJsonItem testPartition = null;
    29       IntRangeJsonItem trainingPartition = null;
    30       StringArrayJsonItem allowedInputVariables = null;
     29      DoubleMatrixJsonItem datasetItem = null;
     30      StringJsonItem targetVariableItem = null;
     31      IntRangeJsonItem testPartitionItem = null;
     32      IntRangeJsonItem trainingPartitionItem = null;
     33      StringArrayJsonItem allowedInputVariablesItem = null;
    3134
    3235      // get all child items
    3336      foreach (var child in data.Children) {
     37        if (!child.Active)
     38          continue;
     39
    3440        if (child.Path.EndsWith(Dataset))
    35           dataset = child as DoubleMatrixJsonItem;
     41          datasetItem = child as DoubleMatrixJsonItem;
    3642        else if (child.Path.EndsWith(TargetVariable))
    37           targetVariable = child as StringJsonItem;
     43          targetVariableItem = child as StringJsonItem;
    3844        else if (child.Path.EndsWith(TestPartition))
    39           testPartition = child as IntRangeJsonItem;
     45          testPartitionItem = child as IntRangeJsonItem;
    4046        else if (child.Path.EndsWith(TrainingPartition))
    41           trainingPartition = child as IntRangeJsonItem;
     47          trainingPartitionItem = child as IntRangeJsonItem;
    4248        else if (child.Path.EndsWith(AllowedInputVariables))
    43           allowedInputVariables = child as StringArrayJsonItem;
     49          allowedInputVariablesItem = child as StringArrayJsonItem;
    4450      }
    4551
    4652      // check data
    47       if(!dataset.ColumnNames.Any(x => x == targetVariable.Value)) {
    48         throw new Exception($"The value of the target variable ('{targetVariable.Value}') has no matching row name value of the dataset.");
     53      if(!datasetItem.ColumnNames.Any(x => x == targetVariableItem.Value)) {
     54        throw new Exception($"The value of the target variable ('{targetVariableItem.Value}') has no matching row name value of the dataset.");
    4955      }
    5056
    51       foreach(var v in allowedInputVariables.Value) {
    52         if(!dataset.ColumnNames.Any(x => x == v))
     57      foreach(var v in allowedInputVariablesItem.Value) {
     58        if(!datasetItem.ColumnNames.Any(x => x == v))
    5359          throw new Exception($"The value of the input variable ('{v}') has no matching row name value of the dataset.");
    5460      }
    5561
    5662      // create the new problemData object
     63      var dataset = datasetItem == null ?
     64        parameter.Value.Dataset :
     65        new Dataset(datasetItem.ColumnNames, datasetItem.Value);
     66
     67      var allowedInputVariables = allowedInputVariablesItem == null ?
     68        parameter.Value.AllowedInputVariables :
     69        allowedInputVariablesItem.Value;
     70
     71      var targetVariable = targetVariableItem == null ?
     72        parameter.Value.TargetVariable :
     73        targetVariableItem.Value;
     74
    5775      var problemData = new RegressionProblemData(
    58         new Dataset(dataset.ColumnNames, dataset.Value),
    59         allowedInputVariables.Value,
    60         targetVariable.Value);
     76        dataset,
     77        allowedInputVariables,
     78        targetVariable);
    6179
    6280      // set the new problemData
Note: See TracChangeset for help on using the changeset viewer.