<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Viya: Deploying Ensemble Model Scoring Code on SAS Studio in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Viya-Deploying-Ensemble-Model-Scoring-Code-on-SAS-Studio/m-p/617699#M182333</link>
    <description>&lt;P&gt;Hello experts,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I developed an ensemble model that includes 4 gradient boosting and 1 logistic regression algorithm. We will schedule the scoring process for new customers by using the code we will develop on Viya SAS Studio.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I could score new data with only a gradient boosting model by the code below:&lt;/P&gt;&lt;P&gt;--------------------------------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;%let input_dsn=DUALSIMVAR_FOR_SCORING_2;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;%let input_extension=sashdat;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;%let inlib=public;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;%let outlib=public;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;* Assign CAS libraries;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;cas;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;caslib _all_ assign;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;* Load Scoring Data into Memory ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;proc casutil; &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;load casdata="&amp;amp;input_dsn..&amp;amp;input_extension." inCASlib="&amp;amp;inlib." &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;casOut="&amp;amp;input_dsn." outCASlib=&amp;amp;outlib. replace; &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;quit;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;* Load the astore model in memory, the name of the model will be in the epscore code and needs to be all UPPERCASE;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;/* GB Model Score Code Data */&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;proc casutil;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;load casdata="_CI90I2WLVU1A7P74YRPLYI7AK_ast.sashdat" inCASlib="models"&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;casOut="DualSimGBmodel" outCASlib=casuser replace;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;quit;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;* Score the new dataset using the EP score code that calls the astore model;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;proc astore;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;score data=&amp;amp;outlib..&amp;amp;input_dsn. out=casuser.scr_GB_&amp;amp;input_dsn. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;rstore=casuser.DualSimGBmodel &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;/* epcode="/Public/Score_Codes/GBModel_EPCode.sas"; */&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;quit;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;--------------------------------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;As you can see, I did not use epcode for this scoring by using one gradient boosting algorithm (commented out).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However,&amp;nbsp;when I dowload score code (EP code) of the ensemble node, there are 4 _AST.sashdat files. I tried to use the same logic like below:&lt;/P&gt;&lt;P&gt;--------------------------------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;/* GeoMean Model Score Code Data */&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;proc casutil;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;load casdata="_7IY8HOERYZLAQG8QPRZ58WA53_ast.sashdat"&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;casdata="_3JFVN5DFZ7HRPCURB691LTM0D_ast.sashdat"&amp;nbsp;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;casdata="_OP7FTXK9YOGMLWB3LQWK53NP_ast.sashdat"&amp;nbsp;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;inCASlib="models"&amp;nbsp;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;casOut="DualSimGeoModel_1" outCASlib=casuser replace;&amp;nbsp;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;quit;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;*create the EP score code to run the ASTORE model on the CAS Server;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;/* */&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;proc astore;&amp;nbsp;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;describe rstore=casuser.DualSimGeoModel&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;epcode="/Public/Score_Codes/EnsembleGeoModel_EPCode.sas" ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;score data=PUBLIC.DualSimScoringData out=casuser.GeoMean_Dual;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;quit;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;--------------------------------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;However we found that first part of the code load only the last casdata statement, it crushes previous ones. So, my question is: "&lt;STRONG&gt;Should I load all astore tables seperately one by one, in this case?&lt;/STRONG&gt;" If so, "&lt;STRONG&gt;How can I use those multiple astore tables through EP code?&lt;/STRONG&gt;".&amp;nbsp;In online documents I found that it is need to use epcode for multiple ASTORE tables, but there was not any examples of multiple astore codes. I share the EP Code of ensemble node.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, when I try to use EPcode statement I get the error of read/write access? If I can get a read/write access authorization would it be enough?&lt;/P&gt;</description>
    <pubDate>Thu, 16 Jan 2020 07:20:42 GMT</pubDate>
    <dc:creator>cgencyurek</dc:creator>
    <dc:date>2020-01-16T07:20:42Z</dc:date>
    <item>
      <title>Viya: Deploying Ensemble Model Scoring Code on SAS Studio</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Viya-Deploying-Ensemble-Model-Scoring-Code-on-SAS-Studio/m-p/617699#M182333</link>
      <description>&lt;P&gt;Hello experts,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I developed an ensemble model that includes 4 gradient boosting and 1 logistic regression algorithm. We will schedule the scoring process for new customers by using the code we will develop on Viya SAS Studio.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I could score new data with only a gradient boosting model by the code below:&lt;/P&gt;&lt;P&gt;--------------------------------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;%let input_dsn=DUALSIMVAR_FOR_SCORING_2;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;%let input_extension=sashdat;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;%let inlib=public;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;%let outlib=public;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;* Assign CAS libraries;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;cas;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;caslib _all_ assign;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;* Load Scoring Data into Memory ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;proc casutil; &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;load casdata="&amp;amp;input_dsn..&amp;amp;input_extension." inCASlib="&amp;amp;inlib." &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;casOut="&amp;amp;input_dsn." outCASlib=&amp;amp;outlib. replace; &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;quit;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;* Load the astore model in memory, the name of the model will be in the epscore code and needs to be all UPPERCASE;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;/* GB Model Score Code Data */&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;proc casutil;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;load casdata="_CI90I2WLVU1A7P74YRPLYI7AK_ast.sashdat" inCASlib="models"&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;casOut="DualSimGBmodel" outCASlib=casuser replace;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;quit;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;* Score the new dataset using the EP score code that calls the astore model;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;proc astore;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;score data=&amp;amp;outlib..&amp;amp;input_dsn. out=casuser.scr_GB_&amp;amp;input_dsn. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;rstore=casuser.DualSimGBmodel &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;/* epcode="/Public/Score_Codes/GBModel_EPCode.sas"; */&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;quit;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;--------------------------------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;As you can see, I did not use epcode for this scoring by using one gradient boosting algorithm (commented out).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However,&amp;nbsp;when I dowload score code (EP code) of the ensemble node, there are 4 _AST.sashdat files. I tried to use the same logic like below:&lt;/P&gt;&lt;P&gt;--------------------------------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;/* GeoMean Model Score Code Data */&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;proc casutil;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;load casdata="_7IY8HOERYZLAQG8QPRZ58WA53_ast.sashdat"&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;casdata="_3JFVN5DFZ7HRPCURB691LTM0D_ast.sashdat"&amp;nbsp;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;casdata="_OP7FTXK9YOGMLWB3LQWK53NP_ast.sashdat"&amp;nbsp;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;inCASlib="models"&amp;nbsp;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;casOut="DualSimGeoModel_1" outCASlib=casuser replace;&amp;nbsp;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;quit;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;*create the EP score code to run the ASTORE model on the CAS Server;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;/* */&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;proc astore;&amp;nbsp;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;describe rstore=casuser.DualSimGeoModel&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;epcode="/Public/Score_Codes/EnsembleGeoModel_EPCode.sas" ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;score data=PUBLIC.DualSimScoringData out=casuser.GeoMean_Dual;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;quit;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;--------------------------------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;However we found that first part of the code load only the last casdata statement, it crushes previous ones. So, my question is: "&lt;STRONG&gt;Should I load all astore tables seperately one by one, in this case?&lt;/STRONG&gt;" If so, "&lt;STRONG&gt;How can I use those multiple astore tables through EP code?&lt;/STRONG&gt;".&amp;nbsp;In online documents I found that it is need to use epcode for multiple ASTORE tables, but there was not any examples of multiple astore codes. I share the EP Code of ensemble node.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, when I try to use EPcode statement I get the error of read/write access? If I can get a read/write access authorization would it be enough?&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jan 2020 07:20:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Viya-Deploying-Ensemble-Model-Scoring-Code-on-SAS-Studio/m-p/617699#M182333</guid>
      <dc:creator>cgencyurek</dc:creator>
      <dc:date>2020-01-16T07:20:42Z</dc:date>
    </item>
  </channel>
</rss>

