Publish Models

In this exercise, you use the comprehensive publishing environment for model delivery to share models. Model delivery most often includes model score code and its associated input and output metadata. You publish a model and the champion model for a project to the SAS Metadata Repository and publish a model to a publish channel. In the next exercise you publish a champion or challenger model to a database. Application software, such as SAS Data Integration Studio or SAS Enterprise Guide, can access the MiningResult object through the SAS Metadata Server and submit on-demand or batch scoring jobs.

Publish a Model to the SAS Metadata Repository

SAS Model Manager uses the SAS Folder view to publish the model to any folder that is accessible to the user. You can publish a model to folders in the SAS Foundation repository or to folders in custom repositories that are created in SAS Management Console to reflect the structure of your business organization.
Note: SAS Model Manager cannot publish R models.
To publish a model to a SAS Metadata Repository, follow these steps:
  1. Expand Loanthen select2012then selectModels and right-click the Tree 1 model. Then select Publish Model. The SAS Metadata Repository dialog box appears.
  2. Navigate to the folder where you want to store the model.
    Publish a model to SAS Metadata Repository
  3. Enter Tree 1 as the name and click Save. If a MiningResult object exists in the same folder and has the same name or model UUID, then you are prompted to decide whether to overwrite the metadata for this stored object.
    CAUTION:
    Do not overwrite an existing MiningResult object unless you are certain that the model is from the same project in SAS Model Manager.
    Note: If you change the score code for the model, then publish the model again to ensure that your score application uses the current scoring code.
  4. In the Publish Model message box, click Close.

Verify the Published Model

View Publish History

After you have published a model to the SAS Metadata Repository, to a SAS channel, or to a database, you can view the publish history in the version, project, MMRoot node details pane. To view the publish history, select the 2012 version in the Loan project, and select the Publish History tab. Select an item from the list to view the publish details.
Publish History Tab

View a Published Model in the SAS Metadata Repository

To verify that SAS Model Manager successfully created the MiningResult object in the SAS Metadata Repository for a published model, use SAS Management Console. To view the contents of the published model or project, you can use SAS Data Integration Studio. You can also use SAS Management Console to export the MiningResult object to a SAS package.
To view a MiningResult object in the metadata repository, follow these steps:
  1. Open SAS Management Console and log on to the SAS Metadata Server using the same user ID that you use to log on to SAS Model Manager.
  2. Click the Folders tab and expand the folders to locate the model that you exported. When you select the folder, the right pane lists the MiningResult objects for the exported models.
    SAS Management Console Folders view for exported models
  3. Right-click the Tree 1 MiningResult object and select Properties from the pop-up menu. The Properties window appears.
  4. Examine the Keywords box on the General tab to verify that the MiningResult object contains the universal unique identifier (UUID) of the exported model. The UUID is a system property that SAS Model Manager automatically assigns to each model. To view a system property in SAS Model Manager, click the + icon beside the System Properties heading to expand the section.
    General properties for model exported to SAS Metadata Repository
    Tip
    You can use the UUID to conduct filtered searches and query the published models. For more information, see the SAS Model Manager: User's Guide.
  5. Examine the metadata on the Advanced tab to determine when the MiningResult object was created or most recently updated.
  6. Click OK.

Publish the Champion Model to the SAS Metadata Repository

To publish the champion model, you must have already assigned the champion model for the project. SAS Model Manager examines the project and always publishes the champion model for the project. When the champion model for a project changes and you publish the model again at the project level, the scoring application automatically uses the latest score code.
To publish the champion model for a project, follow these steps:
  1. Verify that the project has a default version assigned. Select the Loan project folder to examine its properties. TheDefault Version property contains the name of the default version.
  2. Right-click the Loan project and select Publish Modelthen selectto SAS Metadata Repository from the pop-up menu. Click Yes for the information message that the project is unlocked. The SAS Metadata Repository dialog box appears.
  3. Navigate to the folder where you want to store the model.
    Publish Champion model for a project to SAS Metadata Repository
  4. Select the folder and click OK. If a MiningResult object that is in the repository has the same name or UUID, then you are prompted to decide whether to overwrite the metadata for this stored object.
    CAUTION:
    Do not overwrite an existing MiningResult object unless you are certain that the model is from the same project in SAS Model Manager.
  5. In the information message box, click Close.
  6. To view the publish history, select the Loan project, and select the Publish History tab. Select an item from the list to view the publish details.

Publish Models to a SAS Channel

SAS Model Manager uses SAS Publishing Framework to publish models to defined channels. SAS Model Manager creates a SAS Package file (SPK) for the model in a publication channel. Authorized users who subscribe to the channel can choose to receive e-mail notifications when updated models are ready to deploy to testing or production scoring servers and when the SPK file is published to a publication channel. Then you can extract and validate the scoring logic, deploy champion models to a production environment, and monitor the performance of your models.
To publish a model to a channel, follow these steps:
  1. Expand Loanthen select2012 and right-click the Models folder. Then select Publish to a SAS Channel. The Publish to a SAS Channel window appears.
    Tip
    You can publish models from the organization, project, version, or Models folder in the Project Tree.
  2. Select a publication channel from the Channel list.
    Note: The channel values for Description, Subject, and Subscribers are defined in the SAS Metadata Repository with SAS Management Console.
  3. Select Tree 1 as the model to publish in the Select Entries to Publish table. SAS Model Manager lists all of the models in the version folder. To view the entire folder name, expand the ID column heading. Click Next.
    Select to Publish champion model to a SAS channel
  4. Specify an optional subject line for the e-mail message in the Message Subject box. For this example, enter Publish champion model. By default, SAS Model Manager uses the value that is defined in the publication channel. If you omit the subject line, then the name of the published model is used.
  5. In the Notes box include information about the model that might be useful to other users who are involved with the project. For this example, enter Loan project for 2012.
    Message subject line and notes sent when publish model to SAS channel
  6. Click Finish. The information dialog box appears and provides information about whether SAS Model Manager successfully published the model. Click Details to display a log of the publication process and any messages.
  7. Click Close.
  8. To view the publish history, select the 2012 version in the Loan project, and select the Publish History tab. Select an item from the list to view the publish details.
The SAS package that is sent to the publication channel contains the model input, model output, SAS code, and its properties. You can submit a SAS DATA step program that calls the SAS Publish API (Application Programming Interface) to extract and deploy the model to a testing or scoring server. SAS Model Manager also provides a SAS macro program, called MM_GetModels, that extracts the SAS code and metadata to score the model. Typically, extracted files are placed on a local drive of the scoring server that is used to deploy the published model. For more information, see the SAS Model Manager: User's Guide.