Enabling or disabling AI query with SQL DI web UI
You can enable an AI object for AI query when or after the object is created. Enabling AI query trains a neural network model for the object based on the data in the columns you select and optionally the NULL values you specify. You can enable an object for AI query on the AI objects page of the SQL Data Insights (SQL DI) web UI.
Before you begin
Make sure that you have the authorization that is required for a specific task in SQL DI. See Managing SQL DI user permissions and Configuring setup user ID for SQL DI for details.
Procedure
- Sign in your SQL DI web UI with a valid RACF® user ID at the following address:
https://<SQLDI-IPAddress>:<SQLDI-PortNumber>SQL DI uses a login group to identify and authorize users. The default group name is
SQLDIGRP. Make sure that the user ID that you specify is defined in your SQL DI login group. - On the
Connectionspage, select a connection and click theaction menu.
- Select
List AI objectsto open the AI objects page for the connection. - Select an AI object and from the
action menu, select Enable AI query.
- On the Enable AI query page, select and configure the columns that you want to include for your AI queries.
- Select columns and assign SQL DI data types to create a column configuration for the AI object.
You can select one or more columns and assign each column a SQL DI categorical, numeric, or key data type. SQL DI uses your selections to create a column configuration and train a model for the object.
- Categorical: The SQL DI
categoricaldata type is used for columns with discrete values, each of which is its own entity. Typecategoricalis common in columns of many SQL data types. Columns with character or datetime SQL data types, such as CHAR, VARCHAR, DATE, TIME, TIMESTAMP, and TIMESTAMP WITH TIMEZONE, are a SQL DIcategoricaltype, and so are columns with numeric values representing social security or ID numbers. - Numeric: The SQL DI
numericdata type is used for columns with continuous values. Columns with numeric SQL data types, such as SMALLINT, INTEGER, BIGINT, DECIMAL, REAL, FLOAT, and DECFLOAT, are a SQL DInumerictype. SQL DI uses clustering to group numeric values that are close together during the AI query enablement process. - Key: The SQL DI
keydata type is used to indicate that a column represents an entire row. A customer ID column is a SQL DIkeytype. When processing an AI query that includes a column with thekeytype, SQL DI evaluates the affected rows in their entirety and effectively compares all the values in one row to those in another, not just the values in the column of thekeytype.
Important:- SQL data types BINARY, LOB, XML, ROWID, and FOR BIT DATA are currently not supported for AI query enablement. Any BINARY, LOB, XML, ROWID, or FOR BIT DATA column of an AI object is designated as "unsupported" and cannot be selected for the column configuration.
- While you can specify SQL DI data type
categoricalornumericto as many columns as you want, assign typekeyto only one column. - Do not assign SQL DI data type
numericto any non-numeric column, such as a CHAR or VARCHAR column. The conversion of non-numeric data to float might produce unpredictable results, which causes model training to fail. - Treat a column of numeric SQL data type as a SQL DI
categoricaltype if the column contains 10 or fewer distinct values. A grade column in a class schedule table and an interest rate in a bank loan table are good examples. If the grade column has only 6-10 unique values, set the column as a SQL DIcategoricalcolumn. - Make sure that the name of a selected column does not contain any exclamation mark or whitespace character. If you want to include columns with names that don't meet the criteria, create a Db2 view on these columns and include the view in the column configuration.
- If the name of a selected column is longer than 30 bytes, make sure that you set the TABLE_COL_NAME_EXPANSION subsystem parameter to ON in macro DSN6SPRM in Db2. Otherwise, the AI query enablement process will fail. See Db2 TABLE_COL_NAME_EXPANSION subsystem parameter for more information.
Optionally, you can import the column configuration of an AI object that is already enabled for AI query. You must first export the column configuration of the object into a .json file. When importing a column configuration, make sure the columns defined in the JSON file are consistent with those in the AI object that you currently select.
After you complete the column configuration, click Next to continue. The column configuration that you create or import is available for view on the
Model detailspage for the object after the enablement process completes. - Categorical: The SQL DI
- Optionally, specify column values as NULL for model training.
You can specify column values of your choice, such as
N/A,n/a,na,NR,invalid, andempty, as NULL values. SQL DI ignores these user-specified and SQL NULL values during model training.As the field names indicate, the value that you specify in the
Specify NULL values that apply to all columnsfield applies to one or more columns with matching records. The value you specify in theSpecify NULL values that apply to a specific columnfield applies to any matching record within a specific column only. All records that match the specified NULL values are ignored when SQL DI trains the machine model for the AI object.You can specify multiple values separated by semicolons. For example, you can specify
N/A;n/a;na;NR;invalid;emptyas NULL values, and SQL DI will ignore all matching records from model training. - Optionally, specify a Db2 secondary authorization ID to authorize all associated users to manage the AI object and the model.
When specified, the secondary authorization ID, instead of your primary authorization ID, owns the model table and index of the object. All users associated with the specified ID are automatically authorized to manage the object and the model.
Verify that the specified ID has access to SQL DI. See Configuring Db2 for SQL DI for instructions. Also, make sure that the ID is granted sufficient permissions for object and model management. See Managing SQL DI user permissions for details.
- Select columns and assign SQL DI data types to create a column configuration for the AI object.
- Click Enable to start the model training in the background.
If you create your AI objects one at a time, you have the option to enable the object for AI query during the creation process. On the Add object page, click Enable AI query to add the object and enable it for AI query in a single step. See Adding or removing an AI object with SQL DI web UI for more information.
SQL DI starts the enabling process in the background. The entire process may take some time to complete depending on the size of the data in the source Db2 table or view and the number of selected columns in the column configuration. You can monitor and update the model training or retraining status by refreshing the page.
The AI query enabling process completes successfully when the object's status is changed to
Enabledwith a green check mark. TheEnabledstatus indicates that the model for the object is successfully created and trained. If needed, export the column configuration of this object for future use by clickingExport column configurationfrom theaction menu of the object. The column configuration is saved into a .json file.
If the status is
Failedwith a red triangle, repeat steps 4 - 6 to restart the enabling process. Make sure that you review your column configuration and eliminate any error.SQL DI uses the Db2 zLoad utility to upload object model data during the AI query enablement. If the enablement process fails during the zLoad phase, check the Spark log and resolve any data loading errors. When you select to enable AI query on the object again, you will have the option to resume the previously failed process without having to start a new one. When the resumed process completes successfully, the object's status will be changed to
Enabledafter you refresh the UI page.If needed, you can disable the object for AI query by selecting
Disable AI queryfrom the action menu for the object. Afterward, the status of the object is changed toDisabled.If an object is never initiated for AI query enablement, its status remains
Created.