# Difference between revisions of "Model types explained"

(→RationalModel) |
|||

Line 1: | Line 1: | ||

+ | ''We are well aware that documentation is not always complete and possibly even out of date in some cases. We try to document everything as best we can but much is limited by available time and manpower. We are are a university research group after all. The most up to date documentation can always be found (if not here) in the default.xml configuration file and, of course, in the source files. If something is unclear please dont hesitate to [[Reporting problems|ask]].'' |
||

− | ''We are aware that this information might be incomplete. Please check the default.xml configuration file and/or the source files for more detailed information.'' |
||

− | |||

Also see the [[Using a model]] and [[Add Model Type]] pages. |
Also see the [[Using a model]] and [[Add Model Type]] pages. |

## Revision as of 18:24, 8 February 2009

*We are well aware that documentation is not always complete and possibly even out of date in some cases. We try to document everything as best we can but much is limited by available time and manpower. We are are a university research group after all. The most up to date documentation can always be found (if not here) in the default.xml configuration file and, of course, in the source files. If something is unclear please dont hesitate to ask.*

Also see the Using a model and Add Model Type pages.

## Model (Abstract base class)

The `Model`

class serves as an overall base class, it is the interface to which all models should adhere.

## RationalModel

A rational model tries to interpolate or approximate data by a rational function, like <math>3 x^2 y + 5 x y + 2x + 1</math> or by a quotient of 2 polynomial, like <math>\dfrac{xy + 2x + 6y + 2}{xy + 1}</math>

To decide which degrees (monomials) are present in numerator and denominator, the rational model depends on three model parameters:

- Variable weights W1 ... Wd (integer values, one for each dimension)
- Variable flags F1 ... Fd (boolean values, one for each dimension)
- An indicator for the degrees of freedom, P

To determine which degrees to use, this procedure is followed:

- Determine the number of sample points N
- Use P to determine the requested degrees of freedom: freedom = N * P / 100
- Select degrees based on weighting and flags, using following rules:
- Only variables for which Fi == false (0) are allowed in the denominator
- Monomials with degrees (a1 ... ad) get precedence over monomials with degrees (b1 ... bd) if and only if the expression a1*W1 + ... + ad*Wd < b1*W1 + ... + bd*Wd

The calculation of these suitable degrees are delegated to the Degrees class, which uses a Java implementation (Diophantine Solver) to order the monomials using the weighted expression.

Rationale: The weighting scheme is in place because the number of model parameters had to be restricted in some way. [Geest et al.] used such a weighting scheme before to discriminate between variables. The toolbox tries to select suitable values adaptively. In this way, it can eliminate variables which have no significant impact on the output (like in the Kotanchek example).

Please note that *larger weights* correspond to *less important variables*.

Two extra options are of interest:

- Selection of base function (a function handle)
- The frequencyVariable parameter (a variable name, or the keywords auto or off)

It is sometimes advantageous to use a different set of base functions. The default set is just the power function: 1, x, x^2, ... The toolbox provides two alternatives for this, the Legendre base functions, and the Chebyshev base functions. Each occurrence of x^i in the above should be read as *the value of the i'th base function in x*.

When the frequencyVariable parameter resolves to a variable name, or when it is set to auto and there is a variable named f, freq or frequency, that variable is treated differently. First of all it is scaled to by strictly positive. To do this the standard interval [-1,1] is rescaled to [j,2*j], in order to represent a true complex frequency. Then, a standard RationalModel is built, using *only real coefficients*. Only use this feature when complexHandling is set to 'complex', otherwise it is pointless.