BookmarkSubscribeRSS Feed

Here we Flow Again: New SAS Studio Step for Python Model Registration

Started ‎01-19-2024 by
Modified ‎01-05-2024 by
Views 584

As promised last year, this month we released a new step to register Python models from SAS Studio Flows directly into SAS Model Manager. Flows in SAS Studio represent a sequence of operations, where each step is a node on the flow canvas. Data and information flow between the steps. Since flows are commonly used to prepare data and train models, a natural last step of the flow is to register the trained model into SAS Model Manager. In SAS Model Manager the model can be compared, managed, tested, validated, deployed, and monitored alongside all models developed for an analytical use case. Last year, we released a step to register SAS Models and with 2024.01, we now have a step for Python models too!

 

To get started using this new step, do the following:

  1. Add a Table node to the flow canvas. Fill out and run this node to pull your training data into the flow. If your data resides in CAS, be sure to start a CAS session first!
  2. Add a Python Code node to the flow canvas.
  3. Link the Table node to the input port of the Python Code node. Next, open your Python code node. There will be tabs for the Python code, Node options, and Notes. Navigate to the Node tab. From the Node tab, you can see the macro variable used to represent the Table flowing into the Python Code node via the Input Port. Now in your python code, you can create a python data frame from the input data using: 
    dfin = SAS.sd2df(_input1)​
  4. Using the Python Code node, write your model training code. At the end of your training code, use your trained model to score your dataset.  From the Node tab, you can also find the macro variable used for data flowing out of the node via the Output Port. Save your scoring data using:  
    SAS.df2sd(scored_df, _output1)​
  5. Add another Table node to the canvas and link the output port of the Python code node to this Table. Specify where the table should be saved as well as a name for the table. Run the Python Code node and the Table node to populate the table with the scored data.
  6. Add the Register Python Model step to the canvas and link the scored data to the input port of the step. Fill out the step with a name for the model, the trained model name used in the training code, the SAS Model Manager project name, the target variable, the target values, the target event value, the input values, the output classification variable, and the output event probability variable. Run the node.
  7. Open the project in SAS Model Manager and find an executable version of your Python model, ready for governance, management, deployment, and more!

 

Optionally, you can reference a Python code file that is not a part of the flow, but it will need to be saved to the file system of SAS Viya and have been run within the same SAS Studio session.

 

To see the step in action, check out this demo video:

 

What step would you like us to develop next for easy integration between SAS Model Manager and SAS Studio? Add your suggestions to SAS Production Suggestions to let us know!

 

Want to learn more about SAS Studio flows? Check out the following resources:

Version history
Last update:
‎01-05-2024 01:17 PM
Updated by:

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Free course: Data Literacy Essentials

Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning  and boost your career prospects.

Get Started

Article Labels
Article Tags