Documentation Home
HeatWave User Guide
Related Documentation Download this Manual
PDF (US Ltr) - 3.8Mb
PDF (A4) - 3.8Mb


6.9.4 View Model Details

To view the details for the models in your model catalog, query the MODEL_CATALOG table.

Before You Begin

View Details for Your Models

The following example queries model_id, model_handle, and model_owner, train_table_name from the model catalog. Replace user1 with your own user name.

mysql> SELECT model_id, model_handle, model_owner, train_table_name FROM ML_SCHEMA_user1.MODEL_CATALOG;
+----------+-----------------------------------------------------+-------------+----------------------------------------------------------+
| model_id | model_handle                                        | model_owner | train_table_name                                         |
+----------+-----------------------------------------------------+-------------+----------------------------------------------------------+
|        1 | classification_use_case                             | user1       | classification_data.training_data                        |
|        2 | regression_use_case                                 | user1       | regression_data.house_price_training                     |
|        3 | forecasting_use_case                                | user1       | forecasting_data.electricity_demand_training             |
|        4 | anomaly_use_case                                    | user1       | anomaly_detection_data.credit_card_transactions_training |
|        5 | recommendation_use_case_default                     | user1       | recommendations_data.user_ratings_training               |
|        6 | topic_modeling_use_case                             | user1       | topic_modeling_data.movies                               |
+----------+-----------------------------------------------------+-------------+----------------------------------------------------------+
6 rows in set (0.0436 sec)

Where:

  • model_id is a unique numeric identifier for the model.

  • model_owner is the user that created the model.

  • model_handle is the handle by which the model is called.

  • ML_SCHEMA_user1.MODEL_CATALOG is the fully qualified name of the MODEL_CATALOG table. The schema is named for the owning user.

The output displays details from only a few MODEL_CATALOG table columns. For other columns you can query, see The Model Catalog.

View Model Explanations

The ML_EXPLAIN routine generates model explanations and stores them in the model catalog. See Generate Model Explanations to learn more.

A model explanation helps you identify the features that are most important to the model overall. Feature importance is presented as an attribution value. A positive value indicates that a feature contributed toward the prediction. A negative value can have different interpretations depending on the specific model explainer used for the model. For example, a negative value for the permutation importance explainer means that the feature is not important.

To view a model explanation, you can query the model_explanation column from the model catalog by referencing the model handle. Review how to Query the Model Handle.

mysql> SELECT column FROM ML_SCHEMA_user name.MODEL_CATALOG where model_handle='model_handle';

The following example queries one of the model handles and views the model explanation for that model. Optionally, use JSON_PRETTY to view the output in an easily readable format.

mysql> SELECT JSON_PRETTY(model_explanation) FROM ML_SCHEMA_user1.MODEL_CATALOG where model_handle='census_model';
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+
| JSON_PRETTY(model_explanation)                                                                                                                                  |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+
| {
  "permutation_importance": {
    "age": 0.0305,
    "sex": 0.0023,
    "race": 0.0017,
    "fnlwgt": 0.0025,
    "education": 0.0013,
    "workclass": 0.0043,
    "occupation": 0.0229,
    "capital-gain": 0.0495,
    "capital-loss": 0.0156,
    "relationship": 0.0267,
    "education-num": 0.0371,
    "hours-per-week": 0.0142,
    "marital-status": 0.0267,
    "native-country": 0.0
  }
} |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.0447 sec)

Where:

  • ML_SCHEMA_user1.MODEL_CATALOG is the fully qualified name of the MODEL_CATALOG table. The schema is named for the user that created the model.

  • census_data.census_train_user1_1744548610842 is the model handle. See Work with Model Handles.

The output displays feature importance values for each column by using the permutation_importance model explainer.

Alternatively, you can query the model explanation by using the valid session variable for the model handle. Optionally, use JSON_PRETTY to view the output in an easily readable format.

mysql> SELECT JSON_PRETTY(model_explanation) FROM ML_SCHEMA_admin.MODEL_CATALOG where model_handle=@census_model;
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+
| JSON_PRETTY(model_explanation)                                                                                                                                                                                                                                                                                                                                                                           |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+
| {
  "permutation_importance": {
    "age": 0.0305,
    "sex": 0.0023,
    "race": 0.0017,
    "fnlwgt": 0.0025,
    "education": 0.0013,
    "workclass": 0.0043,
    "occupation": 0.0229,
    "capital-gain": 0.0495,
    "capital-loss": 0.0156,
    "relationship": 0.0267,
    "education-num": 0.0371,
    "hours-per-week": 0.0142,
    "marital-status": 0.0267,
    "native-country": 0.0
  }
} |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.0447 sec)

See Work with Model Handles to learn more.

What's Next