LinearRegression Class Reference

[libkorigin Index] [libkorigin Heirarchy]


Fitter for Linear Regression More...

#include </home/mh/korigin/korigin/doc/tmp/linreg.h>

Inherits: Fitter

Public Members


Detailed Description

Fitter for Linear Regression.

An example for a concrete fitter. Though mathematically simple, this is used as a test case for the fitting model draft.

Mathematically, it computes:

S1 = sum xi * yi

S2 = sum xi

S3 = sum yi

S4 = sum x^2

slope = (n * s1 - s2 * s3) / (n * s4 - s2 * s2);

intercept = (s3 - slope * s2) / n;


LinearRegression()

Constructor. Initializes slope and intercept to zero.

const char* name() const

Returns the name of the fitter "Linear Regression".

int execOptionsDialog()

Currently does nothing.

int getInputColumnCount()

Returns the number of input columns, 2. Since linear regression requires 2 input columns, namely "x" and "y", this function returns 2. O wonder.

int getOutputColumnCount()

Returns the number of output columns, 1. The linear regression fitter generates truely linear y's for each "x" input.

const char* getInputColumnName(int i) const

Returns the name of ith input column. For i=0, returns "X". For i=1, returns "Y".

const char* getOutputColumnName(int i) const

Returns the name of the output column, "Y linear". Does so for i=0. For all other values of i, it insults the caller.

bool fit()

Does the actual fit. In this function, the linear regression is actually computed, and the output column is filled.

void saveSettings(KConfig*)

Currently does nothing.

void loadSettings(KConfig*)

Currently does nothing.


  • Author: Patrick Schemitz
  • Documentation generated by mh@jeff_clever on Thu Feb 5 14:15:25 MET 1998
Kdoc