modelPublishing copyModelExternal

Standard Deployment of CLV Model to Hadoop

Scénario de test & Cas d'usage

Business Context

A large retail chain has developed a Customer Lifetime Value (CLV) model in SAS Viya. To integrate this with their nightly batch processing pipelines which run on a Data Lake, they need to publish this model to their Hadoop environment.
Data Preparation

Simulate customer purchase history and train a Gradient Boosting model for CLV prediction.

Copied!
1 
2DATA casuser.clv_data;
3call streaminit(99);
4DO i=1 to 2000;
5recency=rand('integer', 1, 365);
6frequency=rand('poisson', 10);
7monetary=rand('lognormal', 3, 1);
8clv_label= (frequency * monetary) + rand('normal', 0, 50);
9OUTPUT;
10END;
11 
12RUN;
13 
14PROC CAS;
15LOADACTIONSET 'decisionTree';
16decisionTree.gbtreeTrain / TABLE={name='clv_data', caslib='casuser'} target='clv_label' inputs={'recency', 'frequency', 'monetary'} savestate={name='clv_model_store', replace=true};
17LOADACTIONSET 'aStore';
18aStore.save / rstore={name='clv_model_store'} TABLE={name='model_repository', replace=true};
19 
20RUN;
21 

Étapes de réalisation

1
Verify the model repository table is correctly loaded in CAS.
Copied!
1 
2PROC CAS;
3TABLE.tableInfo / caslib='casuser' name='model_repository';
4 
5RUN;
6 
2
Execute the copy action to publish the model to the 'analytics_prod' database in Hadoop.
Copied!
1 
2PROC CAS;
3modelPublishing.copyModelExternal / modelTable={name='model_repository', caslib='casuser'} modelName='clv_model_store' externalCaslib='hadoop_prod' externalOptions={extType='HADOOP', modelDatabase='analytics_prod'};
4 
5RUN;
6 

Expected Result


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.