Difference between revisions of "Model types explained"

From SUMOwiki
Jump to navigationJump to search
 
Line 1: Line 1:
 
''We are well aware that the list below is incomplete 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.  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.''
 
''We are well aware that the list below is incomplete 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.  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.''
  
 +
Also see the [[Using a model]] and [[Add Model Type]] pages.
  
 
== Model (Abstract base class) ==
 
== Model (Abstract base class) ==
  
The Model class serves as an overal base class, it is the interface to which all models should adhere. Part of the model interface is already explained in [[Add Model Type]] and [[Running]]/Loading stored models
+
The Model class serves as an overal base class, it is the interface to which all models should adhere.
 
 
This section explains the remaining methods of Model.
 
 
 
=== plotModel ===
 
 
 
plotModel will generate an indicative plot of the model surface. To do so, it evaluates the model on a reasonably large grid of points.
 
 
 
To determine which kind of plot is generated, one makes a distinction based on the dimension of the input space:
 
* One dimensional models are always plotted in a simple XY line chart. Samples are shown as small crosses.
 
* Two dimensional models are plotted as a matlab *mesh* plot, i.e. a colored surface. The colors are just an indication of height and don't have any further meaning. The samples are plotted as small crosses, and should (hopefuly) approach the surface.
 
* Three dimensional problems are plotted used a custom built [[Slice Plot]].
 
* Four dimensional problems are plotted using 3 [[Slice Plot]]s. The leftmost plot fixes the variable of the fourth variable at -1, the middle plot at 0 and the rightmost plot at 1 (thus reducing the function to a three-dimensional function, making a slice plot possible
 
* Five dimensional problems are plotted using 9 [[Slice Plot]]s. The fourth and fifth variables are fixed at values of -1, 0 and 1. Indicators below the plots show where the variables were fixed.
 
* Higher dimensional problems: All variables after the fifth are fixed at 0, and plotting procedes as if the model was five dimensional.
 
 
 
The toolbox handles '''COMPLEX OUTPUTS''' as their modulus (=absolute value, magnitude) for plotting purposes. These plots are just visual aids for monitoring the modelling process. Phase data can be extracted from the model files, see [[Running]]/Loading stored models.
 
  
 
== PolynomialModel ==
 
== PolynomialModel ==

Revision as of 15:24, 6 February 2008

We are well aware that the list below is incomplete 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. 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.

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

Model (Abstract base class)

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

PolynomialModel

A polynomial model tries to interpolate or approximate data by a polynomial, 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 polynomial 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:

  1. Determine the number of sample points N
  2. Use P to determine the requested degrees of freedom: freedom = N * P / 100
  3. 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. De 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:

  1. Selection of base function (a function handle)
  2. 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 occurence 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 PolynomialModel is built, using only real coefficients. Only use this feature when ComplexHandling is set to complex, otherwise it is pointless.