In the Functions
Panel, by selecting the Static UDFs Tab and checking the Use UDFs box, the Static UDFs
frame lights up and you can now add your own user defined functions.
To add a Static UDF (UDF for short) to your modeling kit, just click the Add button on the Static UDFs frame and the
UDF Editor appears with the function header already
in place.
Then you just have to write the body of the function in the code editor. The code must be in JavaScript and can be rapidly tested for compiling
errors by pressing the Test button.
You will notice that the Arity box is disabled and set to zero as all UDFs will occupy leaf nodes in the trees, that is, they behave exactly as terminals.
In the Definition box, you can write a brief description of the function for your future reference. The text you write here will appear in the Definition
column of the Static UDFs Tab.
The use of UDFs is a very powerful tool as they allow you to explore inside knowledge about relatively simple relationships that exist between certain variables in your data. For instance, suppose you wanted to try out the impact of a moving average in the modeling process. Then you could design
a UDF to express a moving average, for instance, UDF1 = (d0 + d1 + d2 + d3 + d5 + d6 + d7 + d8 + d9)/10, and use this new UDF as an extra
building block in your modeling kit. The advantage of well designed UDFs is that they make the discovery of more complex models composed of several simpler models much easier.
|