Skip to content

Latest commit

 

History

History
124 lines (68 loc) · 7.82 KB

File metadata and controls

124 lines (68 loc) · 7.82 KB

Natural Language Processing (NLP) - Extract Rule Configuration

This custom step extracts the rule configuration within rules-based Visual Text Analytics Concepts or Categories model definitions for use in downstream applications.

Artificial Intelligence demands greater transparency and easier access to underlying metadata. Rule configurations help explain model logic to business stakeholders, promote better model governance, assist in customising models and enable visualisation.

This custom step identifies and extracts such rule configuration tables (located inside system tables) associated with a project, to a user-specified SAS Cloud Analytics Services (CAS) library (a caslib) so that it's easily accessible. It also makes the rule configuration output more consumable through deriving additional columns. This custom step requires a SAS Visual Text Analytics (VTA) license.

A general idea

Extract Rule Configuration

SAS Viya Version Support

Tested in Viya 4, Stable 2023.04

Requirements

  1. A SAS Viya 4 environment (monthly release 2023.04 or later) with SAS Studio Flows.

  2. At runtime: an active connection to CAS: This custom step requires SAS Cloud Analytics Services (CAS). Ensure you have an active CAS connection available prior to running the same.

  3. A SAS Visual Text Analytics (VTA) license.

  4. At least one Visual Text Analytics Model Studio project with a completed Categories or Concepts node. Successfully running a categories or concepts node leads to the creation of system-generated rule configurations within a project caslib.

User Interface

This custom step runs on data loaded to a SAS Cloud Analytics Services (CAS) library (known as a caslib). Ensure you are connected to CAS before running this step.

Prior to running this step, carry out the following task. Note the system-generated caslib name for your required Model Studio (VTA) project. To do this, open the project and go to the Data tab. Copy the entire text appearing on the Properties pane on the right hand side, under the section "Location" (of the form cas-shared-default/Analytics_project_xxx). Paste the entire selection in this field. The custom step contains methods to parse the caslib portion of this text.

Follow this screenshot for reference.

Copy location of configurations

Parameters:

There are three tasks you can carry out with this custom step, as offered in the input parameters.

Input parameters:

  1. Extract tables from a specified list of rule configurations (reference screenshot here): for this purpose, attach a table containing a list of desired rule configurations to the input data port (an optional port) of this step. At a minimum, the table should contain

    1. Name : name of the rule configuration table.
    2. Project_Caslib : name of the system caslib attached to the Model Studio project.
    3. Type : either CATEGORY or CONCEPT based on the project
    4. Astore_Name : name of the astore created after compiling this rule configuration. Note this is an optional field carried through for informational purposes.
  2. Extract a single rule configuration table (reference screenshot here) : this operates on the same principle, with the difference that instead of a list, you can provide a single table name and caslib through the UI. Provide the following:

    1. Project caslib (text field) : system-generated project caslib for a Model Studio project.
    2. Name of rule configuration table (text field) : system-generated rule configuration table name
  3. Generate a list of rule configurations (reference screenshot here) : in case you don't yet know the names of the tables you wish to extract, choose this option to generate a list of all rule configuration tables located within the system caslib. Provide the following.

    • System caslib name for the Model Studio project (text field) : following same instruction as mentioned above.

Output specifications:

  1. Output list of rule configurations (table, output port, optional): connect a SAS dataset which will list all rule configuration tables obtained from a project. This is needed only when you are generating a list of rule configurations.

Note: please DON'T add a CAS table to this output port as this will lead to the step erroring out. In any event, a CAS table isn't necessary for this output, which typically does not contain more than 4-5 observations.

  1. Output caslib for extracted rule configuration tables (text field): fill this in if you are performing extraction tasks. For example, provide Public to indicate that you want all rule configurations to be saved to the shared Public caslib.

The rule configuration tables listed in the output are named as per a pattern : <astore_name>_<project_type>_RULESCONFIG.sashdat. The <astore_name> is usually a long alphanumeric string which is also the same name as the model binary generated. The <project_type> could refer to either CATEGORY or CONCEPT based on the model in question.

Run-time control

Note that this is optional. In some scenarios, you may wish to dynamically control whether this custom step runs or simply "passes through" without doing anything, in a SAS Studio session. The following macro variable is set to initialize with a value of 1 by default, indicating an "enabled" status and allowing the custom step to run.

Refer this blog for more details on the concept.

/* To demonstrate the default value of the trigger macro variable */;

&_erc_run_trigger.=1;

If you wish to control execution of this custom step programmatically (within a session, including execution of a SAS Studio Flow), make sure that an upstream SAS program sets the macro variable to 0. Setting the value to 0 "disables" the execution of this custom step.

For example, to "disable" this step, run the following code upstream:

%global _erc_run_trigger;
%let _erc_run_trigger=0;

To "enable" this step again, run the following (it's assumed that this has already been set as a global variable):

%let _erc_run_trigger=1;

Important: Be aware that disabling this step means that none of its main execution code will run, and any downstream code which was dependent on this code may fail. Change this setting only if it aligns with the objective of your SAS Studio program.

Documentation:

  1. The table.caslibInfo CAS action is used for purposes of listing out the tables within a SAS Model Studio's project caslib. Typical users may find it difficult to access information in the project caslib through the interface, therefore raising need for this custom step.
  2. This SAS Communities article referred to earlier suggests an approach through which execution of this custom step is controlled during run time.

Installation & Usage

Created / contact :

Change Log

Version 1.2 (01AUG2023)

  • A trigger variable added to control run-time execution of the step, plus additional feedback.

Version 1.1 (12JUN2023)

  • Additional documentation, code cleanup; latest version

Version 1.0 (02MAY2023)

  • Initial Step Creation