GET_MODEL_ATTRIBUTE

Extracts either a specific attribute from a model or all attributes from a model. Use this function to view a list of attributes and row counts or view detailed information about a single attribute. The output of GET_MODEL_ATTRIBUTE is a table format where users can select particular columns or rows.

Important: Before using a machine learning function, be aware that all the ongoing transactions might be committed.

Syntax

GET_MODEL_ATTRIBUTE (USING PARAMETERS model_name='model name', 
                     [attr_name='value']) 
 

Parameters

model_name

The name of the model. Model names are case-insensitive.

attr_name
            
(Optional) The name of the model attribute. If the value is not specified, the function shows all available attributes. Attribute names are case-sensitive.

Privileges

To use GET_MODEL_ATTRIBUTE, you must either be the dbadmin, owner of the model or have USAGE privileges. There are no privileges needed on the function itself.

See GRANT (Schema) and GRANT (Table).

Examples

This example shows how you can view a summary of all available attributes for a model.

=> SELECT GET_MODEL_ATTRIBUTE (USING PARAMETERS model_name='myLinearRegModel');
attr_name      |                attr_fields                | #_of_rows
---------------+-------------------------------------------+-----------
data           | coeffNames, coeff, stdErr, zValue, pValue |         2
regularization | type, lambda                              |         1
iterations     | iterations                                |         1
skippedRows    | skippedRows                               |         1
processedRows  | processedRows                             |         1
callStr        | callStr                                   |         1
(6 rows)

This example shows how you can extract the data attribute from the myLinearRegModel model.

=> SELECT GET_MODEL_ATTRIBUTE (USING PARAMETERS model_name='myLinearRegModel', attr_name='data');
coeffNames |       coeff        |       stdErr        |      zValue       |        pValue
-----------+--------------------+---------------------+-------------------+-----------------------
Intercept  |  -1.87401598641074 |   0.160143331525544 | -11.7021169008952 |   7.3592939615234e-26
waiting    | 0.0756279479518627 | 0.00221854185633525 |  34.0890336307608 | 8.13028381124448e-100
(2 rows)