OpenMS
QuadraticRegression.h
Go to the documentation of this file.
1 // Copyright (c) 2002-present, The OpenMS Team -- EKU Tuebingen, ETH Zurich, and FU Berlin
2 // SPDX-License-Identifier: BSD-3-Clause
3 //
4 // --------------------------------------------------------------------------
5 // $Maintainer: Timo Sachsenberg $
6 // $Authors: Christian Ehrlich, Chris Bielow $
7 // --------------------------------------------------------------------------
8 
9 #pragma once
10 
11 #include <OpenMS/CONCEPT/Types.h>
13 
14 #include <iterator>
15 #include <vector>
16 
17 namespace OpenMS
18 {
19  namespace Math
20  {
21  /*
22  @brief Estimates model parameters for a quadratic equation
23 
24  The quadratic equation is of the form
25  y = a + b*x + c*x^2
26 
27  Weighted inputs are supported.
28 
29  */
30  class OPENMS_DLLAPI QuadraticRegression
31  {
32 public:
34 
37  std::vector<double>::const_iterator x_begin,
38  std::vector<double>::const_iterator x_end,
39  std::vector<double>::const_iterator y_begin);
40 
43  std::vector<double>::const_iterator x_begin,
44  std::vector<double>::const_iterator x_end,
45  std::vector<double>::const_iterator y_begin,
46  std::vector<double>::const_iterator w_begin);
47 
49  double eval(double x) const;
50 
52  static double eval(double A, double B, double C, double x);
53 
54  double getA() const;
55  double getB() const;
56  double getC() const;
57  double getChiSquared() const;
58 
59 protected:
60  double a_;
61  double b_;
62  double c_;
63  double chi_squared_;
64  }; //class
65 
66  } //namespace
67 } //namespace
68 
Definition: QuadraticRegression.h:31
double b_
Definition: QuadraticRegression.h:61
double eval(double x) const
void computeRegressionWeighted(std::vector< double >::const_iterator x_begin, std::vector< double >::const_iterator x_end, std::vector< double >::const_iterator y_begin, std::vector< double >::const_iterator w_begin)
double c_
Definition: QuadraticRegression.h:62
void computeRegression(std::vector< double >::const_iterator x_begin, std::vector< double >::const_iterator x_end, std::vector< double >::const_iterator y_begin)
static double eval(double A, double B, double C, double x)
double getChiSquared() const
C*X^2.
double chi_squared_
Definition: QuadraticRegression.h:63
double getB() const
A = the intercept.
double a_
Definition: QuadraticRegression.h:60
You can set more CMake variables adding< code > linking and adding include directories</td ></tr >< tr >< th valign="top"> CMAKE_PREFIX_PATH</td >< td > Additional search path for the contrib libraries[MacOSX only] If you want to use libraries installed via Homebrew or MacPorts you might need to provide the corresponding paths< code > e g< code > C
Definition: common-cmake-parameters.doxygen:35
Main OpenMS namespace.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19