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


HeatWave User Guide  /  ...  /  Row Predictions with Topic Modeling

3.13.3 Row Predictions with Topic Modeling

This section describes how to generate predictions on a row of data with topic modeling.

Before You Begin

Generating Predictions with Topic Modeling

To generate predictions on a row of data with topic modeling:

  1. Use the ML_MODEL_LOAD routine to load the model with topic modeling:

    Press CTRL+C to copy
    mysql> CALL sys.ML_MODEL_LOAD(@topic_modeling, NULL);
  2. Set the row data to generate a prediction for a JSON object literal. The following example includes the row data from the description column:

    Press CTRL+C to copy
    mysql> SET @row_input = JSON_OBJECT('description', "Presidential Jet|Taichung Top Ten Souvenirs|HWC Heiwo Coffee Product features: rich floral and lemon aroma, bright acid value; Layered, from sour to sweet, unique lemon fragrance. Product Description: Origin|Ethiopia Ethiopia Roast Level|Medium Light Processing Method|Washed Flavor DescriptionTastingNotes|Floralscent, lemon, citrus, tropical fruit, lemon, Tangerine, Tropical fruit Brewing method: It is recommended to brew and drink by hand Brewing recommended temperature: medium and shallow roasted Yekashefi 90-92°C Hand brewing thickness suggestion: a little thicker than No. 2 sugar, so that the coffee powder can be extracted completely Product ingredients: 100% Arabica coffee beans Weight: 1/2 pound ");

    @row_input is a session variable containing a row of unlabeled data. The data is specified in JSON key-value format. The column names must match the feature column names in the training dataset.

  3. Use the ML_PREDICT_ROW routine to generate the predictions with topic modeling:

    Press CTRL+C to copy
    mysql> select sys.ML_PREDICT_ROW(@row_input, @topic_modeling, NULL);

    @topic_modeling is the session variable that contains the model handle. Update this name as needed.

To modify the number of word groups in the ml_results column, you can set the topk option. This option must be an integer greater or equal to one.

The following example generates predictions on the row of data with topic modeling and uses the topk option to limit the number of word groups to ten:

Press CTRL+C to copy
mysql> select sys.ML_PREDICT_ROW(@row_input, @topic_modeling, JSON_OBJECT('topk',10));