Scénario de test & Cas d'usage
Create a high-volume transaction dataset and train a complex Forest model.
| 1 | |
| 2 | DATA casuser.fraud_train; |
| 3 | call streaminit(12345); |
| 4 | DO i=1 to 5000; |
| 5 | amount=rand('uniform', 0, 5000); |
| 6 | merchant_cat=rand('integer', 1, 20); |
| 7 | is_fraud=rand('bernoulli', 0.05); |
| 8 | OUTPUT; |
| 9 | END; |
| 10 | |
| 11 | RUN; |
| 12 | |
| 13 | PROC CAS; |
| 14 | LOADACTIONSET 'decisionTree'; |
| 15 | decisionTree.forestTrain / TABLE={name='fraud_train', caslib='casuser'} target='is_fraud' inputs={'amount', 'merchant_cat'} nTree=100 savestate={name='fraud_rf_v2', replace=true}; |
| 16 | LOADACTIONSET 'aStore'; |
| 17 | aStore.save / rstore={name='fraud_rf_v2'} TABLE={name='fraud_models', replace=true}; |
| 18 | |
| 19 | RUN; |
| 20 |
| 1 | |
| 2 | PROC CAS; |
| 3 | TABLE.fileInfo / caslib='teradata_conn'; |
| 4 | |
| 5 | RUN; |
| 6 |
| 1 | |
| 2 | PROC CAS; |
| 3 | modelPublishing.copyModelExternal / modelTable={name='fraud_models', caslib='casuser'} modelName='fraud_rf_v2' modelOptions={replace=true} externalOptions={extType='TERADATA', server='tera_prod_01', database='risk_scoring', username='svc_risk', password='secure_pass_123', modelTable={name='fraud_scoring_logic', schema='risk_scoring'}}; |
| 4 | |
| 5 | RUN; |
| 6 |
The action successfully copies 'fraud_rf_v2' to the 'risk_scoring' database on the Teradata server. If 'fraud_scoring_logic' already existed, it is replaced without error. The output confirms the 'replace' operation was triggered.