OpenMS
TransformationModelLinear Class Reference

Linear model for transformations. More...

#include <OpenMS/ANALYSIS/MAPMATCHING/TransformationModelLinear.h>

Inheritance diagram for TransformationModelLinear:
[legend]
Collaboration diagram for TransformationModelLinear:
[legend]

Public Member Functions

 TransformationModelLinear (const DataPoints &data, const Param &params)
 Constructor. More...
 
 ~TransformationModelLinear () override=default
 Destructor. More...
 
double evaluate (double value) const override
 Evaluates the model at the given value. More...
 
void getParameters (double &slope, double &intercept, String &x_weight, String &y_weight, double &x_datum_min, double &x_datum_max, double &y_datum_min, double &y_datum_max) const
 Gets the "real" parameters. More...
 
void invert ()
 Computes the inverse. More...
 
const ParamgetParameters () const
 Gets the (actual) parameters. More...
 
- Public Member Functions inherited from TransformationModel
 TransformationModel ()
 Constructor. More...
 
 TransformationModel (const TransformationModel::DataPoints &, const Param &)
 
virtual ~TransformationModel ()
 Destructor. More...
 
virtual void weightData (DataPoints &data)
 Weight the data by the given weight function. More...
 
virtual void unWeightData (DataPoints &data)
 Unweight the data by the given weight function. More...
 
bool checkValidWeight (const String &weight, const std::vector< String > &valid_weights) const
 Check for a valid weighting function string. More...
 
double checkDatumRange (const double &datum, const double &datum_min, const double &datum_max)
 Check that the datum is within the valid min and max bounds. More...
 
double weightDatum (const double &datum, const String &weight) const
 Weight the data according to the weighting function. More...
 
double unWeightDatum (const double &datum, const String &weight) const
 Apply the reverse of the weighting function to the data. More...
 
const ParamgetParameters () const
 Gets the (actual) parameters. More...
 
std::vector< StringgetValidXWeights () const
 Returns a list of valid x weight function strings. More...
 
std::vector< StringgetValidYWeights () const
 Returns a list of valid y weight function strings. More...
 

Static Public Member Functions

static void getDefaultParameters (Param &params)
 Gets the default parameters. More...
 
- Static Public Member Functions inherited from TransformationModel
static void getDefaultParameters (Param &params)
 Gets the default parameters. More...
 

Protected Attributes

double slope_
 Parameters of the linear model. More...
 
double intercept_
 
bool data_given_
 Was the model estimated from data? More...
 
bool symmetric_
 Use symmetric regression? More...
 
- Protected Attributes inherited from TransformationModel
Param params_
 Parameters. More...
 
String x_weight_
 x weighting More...
 
double x_datum_min_
 
double x_datum_max_
 
String y_weight_
 y weighting More...
 
double y_datum_min_
 
double y_datum_max_
 
bool weighting_
 

Additional Inherited Members

- Public Types inherited from TransformationModel
typedef std::vector< DataPointDataPoints
 Vector of coordinate pairs. More...
 

Detailed Description

Linear model for transformations.

The model can be inferred from data or specified using explicit parameters. If data is given, a least squares fit is used to find the model parameters (slope and intercept). Depending on parameter symmetric_regression, a normal regression (y on x) or symmetric regression ( \( y - x \) on \( y + x \)) is performed.

Without data, the model can be specified by giving the parameters slope, intercept, x_weight, y_weight explicitly.

Constructor & Destructor Documentation

◆ TransformationModelLinear()

TransformationModelLinear ( const DataPoints data,
const Param params 
)

Constructor.

Exceptions
IllegalArgumentis thrown if neither data points nor explicit parameters (slope/intercept) are given.

◆ ~TransformationModelLinear()

~TransformationModelLinear ( )
overridedefault

Destructor.

Member Function Documentation

◆ evaluate()

double evaluate ( double  value) const
overridevirtual

Evaluates the model at the given value.

Reimplemented from TransformationModel.

◆ getDefaultParameters()

static void getDefaultParameters ( Param params)
static

Gets the default parameters.

◆ getParameters() [1/2]

const Param& getParameters

Gets the (actual) parameters.

◆ getParameters() [2/2]

void getParameters ( double &  slope,
double &  intercept,
String x_weight,
String y_weight,
double &  x_datum_min,
double &  x_datum_max,
double &  y_datum_min,
double &  y_datum_max 
) const

Gets the "real" parameters.

◆ invert()

void invert ( )

Computes the inverse.

Exceptions
DivisionByZerois thrown if the slope is zero.

Member Data Documentation

◆ data_given_

bool data_given_
protected

Was the model estimated from data?

◆ intercept_

double intercept_
protected

◆ slope_

double slope_
protected

Parameters of the linear model.

◆ symmetric_

bool symmetric_
protected

Use symmetric regression?