Create an ASTORE Using SAS Enterprise Miner

Did you know that you can use SAS Enterprise Miner 15.1 to easily create an ASTORE? You can create an ASTORE from an HP SVM node, an HP FOREST node, and also from some SAS Viya Code Nodes! This blog will show you how. I've also created a video on this topic:

Introduction

Recall that an ASTORE (analytic store) is a transportable binary file that contains the state from a predictive analytic procedure. An ASTORE is super convenient because you can transport it to where ever you need it, and you can use it for scoring new data.

An ASTORE “can be produced on one host and consumed on others without the need of traditional SAS export or import. This universal and compact file form was developed to overcome the shortcomings of encoding a large number of rules from hundreds of models (typical in ensembles) into SAS DATA Step code.” Source: SAS 9.4 User’s Guide Seventh Edition.

For example, you can use it to score new data in-database, such as Hadoop or Teradata or other databases. As shown in the table below, you can use an analytic store for importing and scoring as well using it in monitoring model performance in SAS Model Manager.

Source: SAS Model Manager 15.2 User’s Guide

An ASTORE score file can be generated in SAS 9 by:

HP SVM and HP FOREST nodes in SAS Enterprise Miner 14.1+

HPSVM and HPFOREST procedures in SAS High-Performance Data Mining 14.1+

Random Forest and Support Vector Machine models in SAS Factory Miner 14.1+

Create an analytic store from a SAS 9 HP node in Enterprise Miner

HP Forest or HP SVM nodes create analytics stores (ASTOREs). When your Enterprise Miner process flow diagram contains one of these nodes, three files are created:

score.sasast, which contains the analytic store

epscore.sas, which contains the DS2 scoring model program

score.sas, which contains the SAS language score code

A score node and score export node make it easy to get the analytic store. Follow this simple example.

1. Attach the Score node (Assess tab) your HP Forest and HP SVM model nodes, as shown below. I like to rename the nodes to give them more meaningful names.

2. Attach the Score Code Export node (Utility tab) to the score nodes, as below.

3. As I mentioned, I like to rename my nodes to make them a bit more meaningful, as shown below. I also like to add a Reporter node (Utility tab) to the end of my Enterprise Miner process flows.

4. Right click the Reporter node and select Run to run the full process flow.

5. Right click the HPForest Score Code Export node and select Results. Notice that we only see four files here in the Results, and none of them is a .SASAST file.

6. Go to the folder indicated in the Results Summary, here it is C:\SAS9.4\EMProjects\BethDiagramCompiliation\Score\sasdemo_7. Notice that we do in fact have a score.sasast file.

The score node and score code export node are not just for ASTOREs

Be aware that you can use the Score node and the Score Code Export node for other models that don’t create ASTOREs, as shown below.

For example, with the HP Neural file, you will get a score.xml file, but no score.sasast file.

Similarly, we see the same results for an HP Tree model with a Score node and a Score Code Export node.

Comparison to creating ASTOREs in VDMML

For comparison, in VDMML, an ASTORE can be created by four different SAS Viya procedures:

PROC FACTMAC

PROC FOREST

PROC GRADBOOST

PROC SVMACHINE

Note: Not familiar with ASTOREs and how to create them in SAS VDMML? See my blog PROC ASTORE in Viya.

Create an analytic store from a SAS Viya code node in Enterprise Miner

Because Enterprise Miner lets you use SAS Viya Code Nodes to run CAS actions with VDMML procedures, you can also create ASTORES from any Viya Code node that has a SAVESTATE statement!

Let’s walk through this.

A. Be sure that you have included the appropriate Project Start Code in your Enterprise Miner project. Shown below is the code that works on the RACE image associated with my VS|VDMML course.

B. Select Run Now, OK, and close out of the window if it doesn’t close automatically.

C. Let’s first try a neural network Viya Code node. You can write your own code node, but below is an example if you want to use it to try this out.

D. We don’t see a score.sasast file! We see a score.xml file instead. Remember that PROC NNET is not a procedure that has a SAVESTATE statement, and thus we have not created an ASTORE.

E. Instead let’s try a procedure that does have a SAVESTATE statement. As noted above, there are four in VDMML:

PROC FACTMAC (factorization machines)

PROC FOREST (forest models)

PROC GRADBOOST (gradient boosting models)

PROC SVMACHINE (support vector machines)

F. We don’t see the score.sasast file in the Results.

G. But we do can find the score.sasast file in the folder structure!

Summary

Traditionally, you could use the Score node and the Score Export node in Enterprise Miner to get your score.xml file.

With the advent of high performance procedures in SAS 9, two high performance nodes (HP Forest and HP SVM) let you create an analytic store Enterprise Miner. You can again use the Score node and Export Score node to get these files. Also, you can use a SAS Viya Code node to create an analytic store in Enterprise Miner from four VDMML procedures.

Hopefully, this blog will help make scoring a bit easier for you!

For more information

Radhikha Myneni’s SAS High Performance Analytics tip 5: Scoring with Analytic Store

Scoring with Analytics Stores by Merve Yasemin Tekbudak 5

SAS 9.4 User’s Guide: Eighth Edition