Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/11/17 15:55:44 (7 years ago)
Author:
gkronber
Message:

#2697: applied r14390, r14391, r14393, r14394, r14396 again (resolving conflicts)

File:
1 edited

Legend:

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

    r14400 r14843  
    165165      try {
    166166        CalculateModel(ds, rows, scaleInputs);
    167       }
    168       catch (alglib.alglibexception ae) {
     167      } catch (alglib.alglibexception ae) {
    169168        // wrap exception so that calling code doesn't have to know about alglib implementation
    170169        throw new ArgumentException("There was a problem in the calculation of the Gaussian process model", ae);
     
    260259    private static double[,] GetData(IDataset ds, IEnumerable<string> allowedInputs, IEnumerable<int> rows, Scaling scaling) {
    261260      if (scaling != null) {
    262         return AlglibUtil.PrepareAndScaleInputMatrix(ds, allowedInputs, rows, scaling);
     261        // 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);
    263273      } else {
    264         return AlglibUtil.PrepareInputMatrix(ds, allowedInputs, rows);
     274        return ds.ToArray(allowedInputs, rows);
    265275      }
    266276    }
     
    334344        return Enumerable.Range(0, newN)
    335345          .Select(i => ms[i] + Util.ScalarProd(Ks[i], alpha));
    336       }
    337       catch (alglib.alglibexception ae) {
     346      } catch (alglib.alglibexception ae) {
    338347        // wrap exception so that calling code doesn't have to know about alglib implementation
    339348        throw new ArgumentException("There was a problem in the calculation of the Gaussian process model", ae);
     
    381390        }
    382391        return kss;
    383       }
    384       catch (alglib.alglibexception ae) {
     392      } catch (alglib.alglibexception ae) {
    385393        // wrap exception so that calling code doesn't have to know about alglib implementation
    386394        throw new ArgumentException("There was a problem in the calculation of the Gaussian process model", ae);
Note: See TracChangeset for help on using the changeset viewer.