...
If ANYELEMENT/ANYARRAY functionality is not available or not feasible, function name overloading can be used for different argument data types. For example, function F1 from module M1 can have the following versions:
- TEXT data type example:
Code Block | ||
---|---|---|
| ||
madlib.m1_f1( arg1 TEXT) |
...
- Returning a model (Linear Regression):
...
Code Block | ||
---|---|---|
| ||
SELECT mregr_coef(price, array[1, bedroom, bath, size]) from houses; mregr_coef ------------------------------------ {27923.4,-35524.8,2269.34,130.794} |
...
If a particular method returns a complex model that is represented in multiple rows it should be saved into a table with a pre-defined structure. The name of this table (including target schema) should be passed in the function call as an argument.
- Example ([[Decision Tree|http://doc.madlib.net/groupgrpdectree.html]]):
...
Code Block | ||
---|---|---|
| ||
SELECT * FROM madlib.dtree_train( 'user_schema.user_table', 3, 10); output_table ------------------------ user_schema.user_table |
...