Score Model in Hadoop Published from Model Manager


In [1]:
import swat
conn = swat.CAS()
conn.loadactionset('modelpublishing')
conn.runmodelexternal(
    externalOptions = dict(extType = 'hadoop', 
                           inTable = 'hmeq',
                           outTable = 'mm_r_hmeq_scored',
                           forceOverwrite = True,
                           server = server,
                           modelDir = modelDir,
                           classpath = classpath),
    modelName = 'r_hmeq',
)


NOTE: Added action set 'modelpublishing'.
NOTE: Running 'modelPublishing' action set with 3 workers.
NOTE: SAS Embedded Process tracking URL: http://gtpviyaea22.unx.sas.com:8088/proxy/application_1523454812613_0380/
NOTE: Job Status ......: SUCCEEDED
NOTE: Job ID ..........: 1523454812613_380
NOTE: Job Name ........: SASEP SuperReader DEFAULT.HMEQ
NOTE: Tracking URL ....: http://gtpviyaea22.unx.sas.com:8088/proxy/application_1523454812613_0380/
NOTE: File splits..... : 3
NOTE: Input records ...: 5960
NOTE: Input bytes .....: 575959
NOTE: Output records ..: 5960
NOTE: Output bytes ....: 1192000
NOTE: Transcode errors : 0
NOTE: Truncations .....: 0
NOTE: Map Progress ....: 100.00%
NOTE: Execution of model 'R_HMEQ' succeeded.
Out[1]:

elapsed 25.7s · user 0.069s · sys 0.147s · mem 1.28MB

Verify Predictions Were Created


In [2]:
df_scored = conn.loadtable(caslib = 'hadoop', path = 'mm_r_hmeq_scored')['casTable']
df_scored.head()


NOTE: Performing parallel LoadTable action using SAS Data Connect Accelerator for Hadoop.
NOTE: Cloud Analytic Services made the external data from mm_r_hmeq_scored available as table MM_R_HMEQ_SCORED in caslib CASUSERHDFS(jelueb).
Out[2]:
Selected Rows from Table MM_R_HMEQ_SCORED
predicted_bad bad loan mortdue value reason job yoj derog delinq clage ninq clno debtinc pscr_warn probability_0 probability_1
0 0 0.0 26800.0 46236.0 62711.0 DebtCon Office 17.0 0.0 0.0 175.075058 1.0 22.0 33.059934 0.0 0.881349 0.118651
1 0 0.0 26800.0 35485.0 74949.0 DebtCon Mgr 14.0 0.0 0.0 84.766625 5.0 15.0 36.191459 0.0 0.881349 0.118651
2 0 0.0 26800.0 145745.0 211400.0 HomeImp ProfExe 6.0 0.0 0.0 184.711635 1.0 27.0 39.848391 0.0 0.881349 0.118651
3 0 0.0 26800.0 213165.0 282068.0 HomeImp ProfExe 5.0 NaN 4.0 476.728281 NaN 55.0 31.181661 0.0 0.722892 0.277108
4 1 1.0 26800.0 138216.0 170052.0 DebtCon ProfExe 10.0 0.0 0.0 199.738711 1.0 29.0 76.421478 0.0 0.000000 1.000000

In [3]:
conn.endsession()


Out[3]:

elapsed 0.0201s · user 0.003s · sys 0.008s · mem 0.787MB