0.2.0
Loading...
Searching...
No Matches
NAV::PolynomialRegressor< Scalar > Class Template Reference

Polynomial Curve Fitting. More...

Public Types

enum class  Strategy {
  IncrementalLeastSquares ,
  LeastSquares ,
  HouseholderQR ,
  BDCSVD ,
  COD ,
  COUNT
}
 Possible Fit strategies. More...
 

Public Member Functions

Polynomial< Scalar > calcPolynomial () const
 Calculates the polynomial.
 
const ScrollingBuffer< std::pair< Scalar, Scalar > > & data () const
 Gets the underlying buffer.
 
bool empty () const
 Checks if the container has no elements.
 
 PolynomialRegressor (size_t polynomialDegree, size_t windowSize, Strategy strategy=Strategy::HouseholderQR)
 Constructor.
 
void push_back (const Scalar &x, const Scalar &y)
 Add a data point to the polynomial.
 
void push_back (const std::pair< Scalar, Scalar > &dataPoint)
 Add a data point to the polynomial.
 
void reset ()
 Reset the polynomial coefficients and saved data.
 
void setPolynomialDegree (size_t polynomialDegree)
 Set the Polynomial Degree and resets the data.
 
void setStrategy (Strategy strategy)
 Set the strategy for the fit and resets the data.
 
void setWindowSize (size_t windowSize)
 Sets the amount of points used for the fit (sliding window)
 
bool windowSizeReached () const
 Checks if the amount of data points equals the window size.
 

Detailed Description

template<typename Scalar = double>
class NAV::PolynomialRegressor< Scalar >

Polynomial Curve Fitting.

Template Parameters
ScalarData type to store

Member Enumeration Documentation

◆ Strategy

template<typename Scalar = double>
enum class NAV::PolynomialRegressor::Strategy
strong

Possible Fit strategies.

Enumerator
IncrementalLeastSquares 

Incremental Least Squares (only polynomials of order <= 2)

LeastSquares 

Least Squares (bas if even mildly ill-conditioned)

HouseholderQR 

Householder QR decomposition.

BDCSVD 

Bidiagonal Divide and Conquer SVD.

COD 

Complete Orthogonal Decomposition.

COUNT 

Amount of items in the enum.

Constructor & Destructor Documentation

◆ PolynomialRegressor()

template<typename Scalar = double>
NAV::PolynomialRegressor< Scalar >::PolynomialRegressor ( size_t polynomialDegree,
size_t windowSize,
Strategy strategy = Strategy::HouseholderQR )
inline

Constructor.

Parameters
[in]polynomialDegreeDegree of the polynomial to fit
[in]windowSizeAmount of points to use for the fit (sliding window)
[in]strategyStrategy to use

Member Function Documentation

◆ push_back() [1/2]

template<typename Scalar = double>
void NAV::PolynomialRegressor< Scalar >::push_back ( const Scalar & x,
const Scalar & y )
inline

Add a data point to the polynomial.

Parameters
[in]xX Value
[in]yY Value

◆ push_back() [2/2]

template<typename Scalar = double>
void NAV::PolynomialRegressor< Scalar >::push_back ( const std::pair< Scalar, Scalar > & dataPoint)
inline

Add a data point to the polynomial.

Parameters
[in]dataPointData point

◆ setPolynomialDegree()

template<typename Scalar = double>
void NAV::PolynomialRegressor< Scalar >::setPolynomialDegree ( size_t polynomialDegree)
inline

Set the Polynomial Degree and resets the data.

Parameters
[in]polynomialDegreeDegree of the polynomial to fit

◆ setStrategy()

template<typename Scalar = double>
void NAV::PolynomialRegressor< Scalar >::setStrategy ( Strategy strategy)
inline

Set the strategy for the fit and resets the data.

Parameters
strategyStrategy to use for fitting data

◆ setWindowSize()

template<typename Scalar = double>
void NAV::PolynomialRegressor< Scalar >::setWindowSize ( size_t windowSize)
inline

Sets the amount of points used for the fit (sliding window)

Parameters
[in]windowSizeAmount of points to use for the fit

The documentation for this class was generated from the following file: