BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
RVB
Calcite | Level 5 RVB
Calcite | Level 5

Hi All,

 

I'm using Model Studio on SAS Viya 3.4. I am able to run an Open Source Code Node with an R or Python model in it. However, as mentioned in the online documentation, the Open Source Code Node doesn't support the operations "Download score code", "Register model", "Publish model", ... in the Pipeline Comparison tab.

open_source_code_node_SASModelStudio.png

 

These operations are not supported because the Open Source Code node does not generate SAS score code.

 
While looking for a solution, I stumbled upon this:open_source_code_node_SASEM.pngIs a comparable solution possible for the Open Source Code Node in SAS Model Studio on Viya?
1 ACCEPTED SOLUTION

Accepted Solutions
joeFurbee
Community Manager

Hi @RVB ,

I received the following response to your question from a colleague of mine:

This is a little bit hacky but:

  • One solution would be to perform the Python/R model to PMML conversion inside the node and save the output PMML in an accessible location.
    • For R you can use the PMML package or r2pmml package
    • For Python, you can use nyoka or sklearn2pmml
  • Validate that the output PMML file confirms to the v4.2 standard that SAS supports up to
  • PMML file can be converted by importing into Model Manager via GUI, or you could have your PMML file in your SAS lib and invoke PROC PSCORE directly in SAS Studio.
    • Upon success, you should have a 'score.sas' file
    • If not, this means the PMML file did not conform to the v4.2 standard we support

 

I have a code example below based off the R RandomForest example on our public GitHub - it's a bit spaghetti since I don't know R but the key is you must output the PMML file in an accessible directory, either by changing 'dm_nodedir' or use the R function 'setwd()' which I did (for Python, do the equivalent as well)

 

P.S. To state the obvious - this requires Model Manager licensed since PROC PSCORE is bundled with it.

 

Hope this helps,

Joe


Join us for SAS Community Trivia
SAS Bowl XXXVIII, SAS Programming: Getting Started
Wednesday, February 14, 2024, at 10 a.m. ET | #SASBowl

View solution in original post

3 REPLIES 3
joeFurbee
Community Manager

The Coding on SAS Viya Community is sunsetting and all threads have moved to the Developers Community. Moving this thread now.

 

@RVB, I'll look into finding someone to answer your question.


Join us for SAS Community Trivia
SAS Bowl XXXVIII, SAS Programming: Getting Started
Wednesday, February 14, 2024, at 10 a.m. ET | #SASBowl

joeFurbee
Community Manager

Hi @RVB ,

I received the following response to your question from a colleague of mine:

This is a little bit hacky but:

  • One solution would be to perform the Python/R model to PMML conversion inside the node and save the output PMML in an accessible location.
    • For R you can use the PMML package or r2pmml package
    • For Python, you can use nyoka or sklearn2pmml
  • Validate that the output PMML file confirms to the v4.2 standard that SAS supports up to
  • PMML file can be converted by importing into Model Manager via GUI, or you could have your PMML file in your SAS lib and invoke PROC PSCORE directly in SAS Studio.
    • Upon success, you should have a 'score.sas' file
    • If not, this means the PMML file did not conform to the v4.2 standard we support

 

I have a code example below based off the R RandomForest example on our public GitHub - it's a bit spaghetti since I don't know R but the key is you must output the PMML file in an accessible directory, either by changing 'dm_nodedir' or use the R function 'setwd()' which I did (for Python, do the equivalent as well)

 

P.S. To state the obvious - this requires Model Manager licensed since PROC PSCORE is bundled with it.

 

Hope this helps,

Joe


Join us for SAS Community Trivia
SAS Bowl XXXVIII, SAS Programming: Getting Started
Wednesday, February 14, 2024, at 10 a.m. ET | #SASBowl

RVB
Calcite | Level 5 RVB
Calcite | Level 5

Hi Joe,

 

Thanks a lot for your answer!

 

Robbe

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 2262 views
  • 1 like
  • 2 in conversation