Loads a binary model file, such as a sentiment analysis model (SAM), a category model (MCO), or a concept model (LI), from a specified path on the client machine and creates a CAS table containing the binary data. This action is essential for making externally compiled models available for use in subsequent CAS actions within the textRuleScore action set.
| Parameter | Description |
|---|---|
| path | Specifies the full path on the controller where the binary model file (SAM, MCO, or LI) is located. |
| casOut | Specifies the output CAS table that will be created to store the binary model data. This table is required for subsequent scoring actions. |
| caslib | Specifies the CAS library to be used. While the documentation lists it, the primary caslib is often defined by the session context. |
This action does not create data in the traditional sense. It requires a pre-compiled binary model file (e.g., .sam for sentiment, .mco for categories, .li for concepts) to be present on the CAS server's file system at a path accessible by the server. The following examples assume that such files exist.
| 1 | /* No SAS code is needed to create the model file here. */ |
| 2 | /* Assumption: A sentiment model file named 'sentiment.sam' exists in the '/path/to/your/models/' directory on the CAS server. */ |
This example demonstrates how to load a sentiment analysis model from a .sam binary file located on the server into a new CAS table named 'sentiment_model'. The 'replace=true' option ensures that if the table already exists, it will be overwritten.
| 1 | |
| 2 | PROC CAS; |
| 3 | textRuleScore.loadTableFromDisk / path='/path/to/your/models/sentiment.sam' casOut={name='sentiment_model', replace=true}; |
| 4 | |
| 5 | RUN; |
| 6 |
This example loads a category model from a .mco binary file into a CAS table named 'category_model'. The 'promote=true' option makes the table available to all subsequent CAS sessions, not just the current one. A descriptive label is also added to the output table for better identification.
| 1 | |
| 2 | PROC CAS; |
| 3 | textRuleScore.loadTableFromDisk / path='/path/to/your/models/categories.mco' casOut={name='category_model', caslib='casuser', replace=true, promote=true, label='My Category Model for Scoring'}; |
| 4 | |
| 5 | RUN; |
| 6 |
This example shows how to load a concept model (LITI model) from a .li binary file into a CAS table. This is a common step before using the 'applyConcept' action to extract concepts from a document collection.
| 1 | |
| 2 | PROC CAS; |
| 3 | textRuleScore.loadTableFromDisk / path='/path/to/your/models/concepts.li' casOut={name='concepts_model_table', replace=true}; |
| 4 | |
| 5 | RUN; |
| 6 |