Ignore:
Timestamp:
12/20/19 13:21:43 (22 months ago)
Author:
djoedick
Message:

#3044: Added new implementation for transformation of input variables in KernelRidgeRegressionModel and added helper methods in transformation base class.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3044_variableScaling/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Transformations/Transformation.cs

    r17389 r17390  
    6161    protected Transformation(IEnumerable<string> allowedColumns) {
    6262      var allowed = new ItemSet<StringValue>(allowedColumns.Select(e => new StringValue(e)));
    63       Parameters.Add(new ConstrainedValueParameter<StringValue>(ColumnParameterName, "Column used for the Transformation", allowed));
     63      Parameters.Add(new ConstrainedValueParameter<StringValue>(ColumnParameterName, "Column used for the Transformation", allowed, allowed.First()));
    6464    }
     65
     66
     67    //TODO: Fill XML comments
     68    /// <summary>
     69    /// Creates transformation for the provided input variables.
     70    /// </summary>
     71    /// <param name="transformation"></param>
     72    /// <param name="dataset"></param>
     73    /// <param name="rows"></param>
     74    /// <param name="allowedInputVariables"></param>
     75    /// <returns></returns>
     76    public static ITransformation<double>[] CreateTransformations(ITransformation<double> transformation, IDataset dataset, int[] rows, IReadOnlyCollection<string> allowedInputVariables) {
     77      var trans = new ITransformation<double>[allowedInputVariables.Count];
     78      int i = 0;
     79      foreach (var variable in allowedInputVariables) {
     80        var trans_clone = (ITransformation<double>)transformation.Clone();
     81        trans_clone.Column = variable;
     82        trans_clone.ConfigureParameters(dataset.GetDoubleValues(variable, rows));
     83        trans[i] = trans_clone;
     84        i++;
     85      }
     86      return trans;
     87    }
     88
    6589  }
    6690
     
    85109
    86110    public abstract bool Check(IEnumerable<T> data, out string errorMsg);
     111
     112
    87113  }
    88114}
Note: See TracChangeset for help on using the changeset viewer.