Free cookie consent management tool by TermsFeed Policy Generator

Changeset 17388


Ignore:
Timestamp:
12/20/19 11:37:00 (5 years ago)
Author:
djoedick
Message:

#3044: Added parameter for input variable scaling for regression problems.

Location:
branches/3044_variableScaling/HeuristicLab.Problems.DataAnalysis/3.4
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/3044_variableScaling/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionProblemData.cs

    r17180 r17388  
    1 #region License Information
     1#region License Information
    22/* HeuristicLab
    33 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     
    3434  public class RegressionProblemData : DataAnalysisProblemData, IRegressionProblemData, IStorableContent {
    3535    protected const string TargetVariableParameterName = "TargetVariable";
     36    protected const string ScaleInputsParameterName = "Scale Inputs";
    3637    public string Filename { get; set; }
    3738
     
    110111    }
    111112
     113    public IFixedValueParameter<BoolValue> ScaleInputsParameter {
     114      get { return (IFixedValueParameter<BoolValue>)Parameters[ScaleInputsParameterName]; }
     115    }
     116
     117    public bool ScaleInputs {
     118      get { return ScaleInputsParameter.Value.Value; }
     119      set { ScaleInputsParameter.Value.Value = value; }
     120    }
     121
    112122    public IEnumerable<double> TargetVariableValues {
    113123      get { return Dataset.GetDoubleValues(TargetVariable); }
     
    120130    }
    121131
    122 
    123132    [StorableConstructor]
    124133    protected RegressionProblemData(StorableConstructorFlag _) : base(_) { }
    125134    [StorableHook(HookType.AfterDeserialization)]
    126135    private void AfterDeserialization() {
     136      if (!Parameters.ContainsKey(ScaleInputsParameterName)) {
     137        Parameters.Add(new FixedValueParameter<BoolValue>(ScaleInputsParameterName, "If enabled input features are scaled by a standard transformation (µ=0, σ=1)", new BoolValue(false)));
     138      }
    127139      RegisterParameterEvents();
    128140    }
     
    152164      var variables = InputVariables.Select(x => x.AsReadOnly()).ToList();
    153165      Parameters.Add(new ConstrainedValueParameter<StringValue>(TargetVariableParameterName, new ItemSet<StringValue>(variables), variables.Where(x => x.Value == targetVariable).First()));
     166      Parameters.Add(new FixedValueParameter<BoolValue>(ScaleInputsParameterName, "If enabled input features are scaled by a standard transformation (µ=0, σ=1)", new BoolValue(false)));
    154167      RegisterParameterEvents();
    155168    }
  • branches/3044_variableScaling/HeuristicLab.Problems.DataAnalysis/3.4/Interfaces/Regression/IRegressionProblemData.cs

    r17180 r17388  
    3131    IEnumerable<double> TargetVariableTrainingValues { get; }
    3232    IEnumerable<double> TargetVariableTestValues { get; }
     33
     34    bool ScaleInputs { get; set; }
    3335  }
    3436}
Note: See TracChangeset for help on using the changeset viewer.