modelPublishing copyModelExternal

High-Frequency Update of Fraud Model in Teradata

Scénario de test & Cas d'usage

Business Context

A financial institution updates its Fraud Detection model weekly to adapt to new attack vectors. The model must be pushed to a Teradata appliance used for high-volume transaction scoring. It is critical that the new model overwrites the previous version seamlessly.
Data Preparation

Create a high-volume transaction dataset and train a complex Forest model.

Copied!
1 
2DATA casuser.fraud_train;
3call streaminit(12345);
4DO i=1 to 5000;
5amount=rand('uniform', 0, 5000);
6merchant_cat=rand('integer', 1, 20);
7is_fraud=rand('bernoulli', 0.05);
8OUTPUT;
9END;
10 
11RUN;
12 
13PROC CAS;
14LOADACTIONSET 'decisionTree';
15decisionTree.forestTrain / TABLE={name='fraud_train', caslib='casuser'} target='is_fraud' inputs={'amount', 'merchant_cat'} nTree=100 savestate={name='fraud_rf_v2', replace=true};
16LOADACTIONSET 'aStore';
17aStore.save / rstore={name='fraud_rf_v2'} TABLE={name='fraud_models', replace=true};
18 
19RUN;
20 

Étapes de réalisation

1
Pre-check: Ensure the connection to Teradata is valid.
Copied!
1 
2PROC CAS;
3TABLE.fileInfo / caslib='teradata_conn';
4 
5RUN;
6 
2
Copy the model to Teradata, explicitly forcing an overwrite of any existing model with the same name.
Copied!
1 
2PROC CAS;
3modelPublishing.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 
5RUN;
6 

Expected Result


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.