Free cookie consent management tool by TermsFeed Policy Generator

Changeset 14854 for trunk


Ignore:
Timestamp:
04/12/17 10:31:51 (8 years ago)
Author:
gkronber
Message:

#2697: introduced original code for scaling from AlglibUtil into GaussianProcessModel to guarantee backwards compatibility regarding unit test results

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessModel.cs

    r14843 r14854  
    259259    private static double[,] GetData(IDataset ds, IEnumerable<string> allowedInputs, IEnumerable<int> rows, Scaling scaling) {
    260260      if (scaling != null) {
     261        // BackwardsCompatibility3.3
     262        #region Backwards compatible code, remove with 3.4
    261263        // TODO: completely remove Scaling class
    262         List<ITransformation<double>> transformations = new List<ITransformation<double>>();
    263 
    264         foreach (var varName in allowedInputs) {
    265           double min;
    266           double max;
    267           scaling.GetScalingParameters(varName, out min, out max);
    268           var add = -min / (max - min);
    269           var mult = 1.0 / (max - min);
    270           transformations.Add(new LinearTransformation(allowedInputs) { Addend = add, Multiplier = mult });
    271         }
    272         return ds.ToArray(allowedInputs, transformations, rows);
     264        List<string> variablesList = allowedInputs.ToList();
     265        List<int> rowsList = rows.ToList();
     266
     267        double[,] matrix = new double[rowsList.Count, variablesList.Count];
     268
     269        int col = 0;
     270        foreach (string column in variablesList) {
     271          var values = scaling.GetScaledValues(ds, column, rowsList);
     272          int row = 0;
     273          foreach (var value in values) {
     274            matrix[row, col] = value;
     275            row++;
     276          }
     277          col++;
     278        }
     279        return matrix;
     280        #endregion
    273281      } else {
    274282        return ds.ToArray(allowedInputs, rows);
Note: See TracChangeset for help on using the changeset viewer.