OpenMS
TransformationModelLowess.h
Go to the documentation of this file.
1 // Copyright (c) 2002-present, OpenMS Inc. -- EKU Tuebingen, ETH Zurich, and FU Berlin
2 // SPDX-License-Identifier: BSD-3-Clause
3 //
4 // --------------------------------------------------------------------------
5 // $Maintainer: Hannes Roest $
6 // $Authors: Hannes Roest $
7 // --------------------------------------------------------------------------
8 
9 #pragma once
10 
11 #include <OpenMS/config.h> // is this needed?
14 
15 namespace OpenMS
16 {
17 
23  class OPENMS_DLLAPI TransformationModelLowess :
24  public TransformationModel
25  {
26 public:
32  TransformationModelLowess(const DataPoints& data, const Param& params);
33 
36 
38  double evaluate(double value) const override
39  {
40  return model_->evaluate(value);
41  }
42 
44 
46  static void getDefaultParameters(Param& params);
47 
48 private:
49  // Hide helper utilities from public API. Defined in the .cpp.
50 
52 
72  static std::vector<double> buildSpanGrid(Size n_pts,
73  const std::vector<double>& candidate_spans,
74  double span_min_param,
75  double span_max_param,
76  int min_neighbors);
77 
79  enum class CVMetric
80  {
81  RMSE,
82  MAE,
83  P90,
84  P95,
85  P99,
86  SIZE_OF_CVMETRIC
87  };
88  static const std::array<std::string, (Size)CVMetric::SIZE_OF_CVMETRIC> names_of_cvmetric;
89 
104  static double scoreResiduals(const std::vector<double>& errs, CVMetric metric);
105 
107  static constexpr double kTieTol = 1e-12;
108 
110 
111 
112 protected:
115 
116  };
117 } // namespace
118 
Management and storage of parameters / INI files.
Definition: Param.h:44
Interpolation model for transformations.
Definition: TransformationModelInterpolated.h:45
Lowess (non-linear) model for transformations.
Definition: TransformationModelLowess.h:25
TransformationModelLowess(const DataPoints &data, const Param &params)
Constructor.
static void getDefaultParameters(Param &params)
Gets the default parameters.
~TransformationModelLowess() override
Destructor.
double evaluate(double value) const override
Evaluates the model at the given value.
Definition: TransformationModelLowess.h:38
TransformationModelInterpolated * model_
Pointer to the underlying interpolation.
Definition: TransformationModelLowess.h:114
Base class for transformation models.
Definition: TransformationModel.h:29
const Param & getParameters() const
Gets the (actual) parameters.
std::vector< DataPoint > DataPoints
Vector of coordinate pairs.
Definition: TransformationModel.h:65
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:97
Main OpenMS namespace.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19