Building models with SAS Enterprise Miner, SAS Factory Miner, SAS Visual Data Mining and Machine Learning or just with programming

Scoring PROC HPForest

Accepted Solution Solved
Reply
New Contributor
Posts: 4
Accepted Solution

Scoring PROC HPForest

[ Edited ]

Hello All,

I've created a small model using Proc HPFOREST and scored using HP4SCORE (code below).

Is there anyway I can export the Random Forest SAS code with actual model?

 

I need to implement this model in a platform other than SAS and as such I need the SAS code for model itself.

 

Thank you,

Marcelo

 

proc hpforest data= train leafsize=20;

   target survived / level= binary;

   input SibSp Parch / level= binary;

   input age / level= interval;

   input sex / level= nominal;

 

   ods output fitstatistics = fitstats;

   save file = "c:\temp\model_fit.bin";

run;

 

proc surveyselect data= train

   method=srs N=100 out= samp;

run;

 

proc hp4score data=samp;

   id survived;

   score file= "c:\temp\model_fit.bin"

   out=scored;

   performance details;

run;


Accepted Solutions
Solution
‎07-06-2017 01:35 PM
SAS Super FREQ
Posts: 271

Re: Scoring PROC HPForest

Actually you can't get SAS Data step, C, Java, or PMML score code for HP Forest models.  You need to use either the HP4SCORE or ASTORE procedures.

 

This tip has information about scoring with PROC ASTORE:

https://communities.sas.com/t5/SAS-Communities-Library/SAS-High-Performance-Analytics-tip-5-Scoring-...

 

And if you are trying to score data in a database, this tip walks through how to use the score code (with HP4SCORE) to score distributed data: https://communities.sas.com/t5/SAS-Communities-Library/Tip-How-Can-I-Apply-HP-Forest-Score-Code-to-D...

 

View solution in original post


All Replies
Super User
Posts: 17,784

Re: Scoring PROC HPForest

If you have SAS EM you can export your score code into SAS, You can also get a PMML, C or Java score code. 

 

I can't access the docs but look for a CODE statement to see if that will generate the SAS code for you. 

 

New Contributor
Posts: 4

Re: Scoring PROC HPForest

 Hi Reeza,

Thank you for helping.

 

I do not have EM either. I can run HPForest in SAS code only because my license has access to the High Performnce module.

 

I've tried the seraching for "code" statements. What I found was something like "code file = <file location>" but it does not seem to work with HPforest. Or maybe I do know the correct syntax.

 

Would yoy have any other suggestion?

 

Thank you 

Super User
Posts: 17,784

Re: Scoring PROC HPForest

Is there a RULES statement?

What does the following show? 

 

Proc setinit;

proc product_status;

run;

 

HPFOREST isn't listed under HP Stat procedures...I'm mostly curious here. 

New Contributor
Posts: 4

Re: Scoring PROC HPForest

Intersting, it appears that I do have license for EM

---SAS Enterprise Miner Server/Client v13.1

However I do not have acces to it.

 

I believe I am able to run HPForest because I also have access to

---High Performance Suite v2.2

 

 

I cannot find any good syntax reference for HPforest or HP4score.

Do you have an example of RULES statement fir HPforest or HP4Score?

 

Thanks again

Solution
‎07-06-2017 01:35 PM
SAS Super FREQ
Posts: 271

Re: Scoring PROC HPForest

Actually you can't get SAS Data step, C, Java, or PMML score code for HP Forest models.  You need to use either the HP4SCORE or ASTORE procedures.

 

This tip has information about scoring with PROC ASTORE:

https://communities.sas.com/t5/SAS-Communities-Library/SAS-High-Performance-Analytics-tip-5-Scoring-...

 

And if you are trying to score data in a database, this tip walks through how to use the score code (with HP4SCORE) to score distributed data: https://communities.sas.com/t5/SAS-Communities-Library/Tip-How-Can-I-Apply-HP-Forest-Score-Code-to-D...

 

New Contributor
Posts: 4

Re: Scoring PROC HPForest

Thanks very much for your help Wendy.

 

I've come across HP4score and it works fine. My challenge is to produce code out of an HPforest procedure which can be used to implement the model outside of SAS (using C++ for instance). Based on your response this does not seem possible.

 

I've tried HPneural and it seems like is can output as SAS code "score out=survived_score"; It would handy if this statement was also available in HPforrest.

 

Thank you again.

SAS Super FREQ
Posts: 271

Re: Scoring PROC HPForest

The HPFOREST procedure does also support a SCORE statement where you can specify the output (scored) data set.  

New Contributor
Posts: 2

Re: Scoring PROC HPForest

I have added the below two lines to my Random Forest Code:

 

   ods output fitstatistics = fitstats;

   save file = "c:\temp\model_fit.bin";

 

 

I get the below error:

 

Unable to open model file for writing.

 

Why am I seeing this error? How can I get rid of it?

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 8 replies
  • 1410 views
  • 4 likes
  • 4 in conversation