Changeset 14393 for trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessModel.cs
- Timestamp:
- 11/15/16 21:23:43 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessModel.cs
r14185 r14393 165 165 try { 166 166 CalculateModel(ds, rows, scaleInputs); 167 } 168 catch (alglib.alglibexception ae) { 167 } catch (alglib.alglibexception ae) { 169 168 // wrap exception so that calling code doesn't have to know about alglib implementation 170 169 throw new ArgumentException("There was a problem in the calculation of the Gaussian process model", ae); … … 260 259 private static double[,] GetData(IDataset ds, IEnumerable<string> allowedInputs, IEnumerable<int> rows, Scaling scaling) { 261 260 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); 263 273 } else { 264 return AlglibUtil.PrepareInputMatrix(ds,allowedInputs, rows);274 return ds.ToArray(allowedInputs, rows); 265 275 } 266 276 } … … 334 344 return Enumerable.Range(0, newN) 335 345 .Select(i => ms[i] + Util.ScalarProd(Ks[i], alpha)); 336 } 337 catch (alglib.alglibexception ae) { 346 } catch (alglib.alglibexception ae) { 338 347 // wrap exception so that calling code doesn't have to know about alglib implementation 339 348 throw new ArgumentException("There was a problem in the calculation of the Gaussian process model", ae); … … 381 390 } 382 391 return kss; 383 } 384 catch (alglib.alglibexception ae) { 392 } catch (alglib.alglibexception ae) { 385 393 // wrap exception so that calling code doesn't have to know about alglib implementation 386 394 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.