Scénario de test & Cas d'usage
Simulate customer purchase history and train a Gradient Boosting model for CLV prediction.
| 1 | |
| 2 | DATA casuser.clv_data; |
| 3 | call streaminit(99); |
| 4 | DO i=1 to 2000; |
| 5 | recency=rand('integer', 1, 365); |
| 6 | frequency=rand('poisson', 10); |
| 7 | monetary=rand('lognormal', 3, 1); |
| 8 | clv_label= (frequency * monetary) + rand('normal', 0, 50); |
| 9 | OUTPUT; |
| 10 | END; |
| 11 | |
| 12 | RUN; |
| 13 | |
| 14 | PROC CAS; |
| 15 | LOADACTIONSET 'decisionTree'; |
| 16 | decisionTree.gbtreeTrain / TABLE={name='clv_data', caslib='casuser'} target='clv_label' inputs={'recency', 'frequency', 'monetary'} savestate={name='clv_model_store', replace=true}; |
| 17 | LOADACTIONSET 'aStore'; |
| 18 | aStore.save / rstore={name='clv_model_store'} TABLE={name='model_repository', replace=true}; |
| 19 | |
| 20 | RUN; |
| 21 |
| 1 | |
| 2 | PROC CAS; |
| 3 | TABLE.tableInfo / caslib='casuser' name='model_repository'; |
| 4 | |
| 5 | RUN; |
| 6 |
| 1 | |
| 2 | PROC CAS; |
| 3 | modelPublishing.copyModelExternal / modelTable={name='model_repository', caslib='casuser'} modelName='clv_model_store' externalCaslib='hadoop_prod' externalOptions={extType='HADOOP', modelDatabase='analytics_prod'}; |
| 4 | |
| 5 | RUN; |
| 6 |
The action completes with a success status. The 'clv_model_store' is physically copied to the 'analytics_prod' Hive database within the Hadoop cluster referenced by 'hadoop_prod'. Logs confirm the creation of the external model table.