bart bartProbit

Standard Case: Customer Response Prediction for a Marketing Campaign

Scénario de test & Cas d'usage

Business Context

A financial services company wants to predict which customers are likely to respond to a new loan offer. The goal is to build a reliable classification model using customer demographics and historical data, partition the data for validation, and save the final model for future scoring of new customer lists.
About the Set : bart

Bayesian Additive Regression Trees models.

Discover all actions of bart
Data Preparation

Create a dataset simulating customer profiles and their response to a previous campaign. Predictors include Age, Income, number of existing products, and home ownership status. The target 'Responded' is binary (1/0).

Copied!
1DATA customer_offers;
2 call streaminit(2024);
3 DO CustomerID = 1 to 20000;
4 Age = 22 + floor(rand('Uniform') * 48);
5 Income = 45000 + floor(rand('Uniform') * 150000);
6 ExistingProducts = 1 + floor(rand('Uniform') * 5);
7 IF rand('Uniform') < 0.6 THEN OwnsHome = 'Yes';
8 ELSE OwnsHome = 'No';
9 logit_p = -2.5 + (Age / 20) - (Income / 90000) + (ExistingProducts * 0.3) - (ifc(OwnsHome='Yes', 0.5, 0));
10 p = 1 / (1 + exp(-logit_p));
11 Responded = rand('Bernoulli', p);
12 OUTPUT;
13 END;
14RUN;
15 
16DATA casuser.customer_offers_train;
17 SET customer_offers;
18RUN;

Étapes de réalisation

1
Load the customer data into CAS and verify the table structure.
Copied!
1PROC CAS;
2 TABLE.tableInfo TABLE={caslib='CASUSER', name='customer_offers_train'};
3RUN;
4QUIT;
2
Run bart.bartProbit, partitioning the data (75% train, 25% test), specifying 150 trees, and saving the model.
Copied!
1PROC CAS;
2 bart.bartProbit TABLE={name='customer_offers_train'},
3 target='Responded',
4 inputs={'Age', 'Income', 'ExistingProducts'},
5 nominals={'OwnsHome'},
6 partByFrac={test=0.25, seed=1985},
7 nTree=150,
8 nBI=200,
9 nMC=1500,
10 seed=1234,
11 OUTPUT={casOut={name='customer_response_preds', replace=true}, pred='P_Responded'},
12 store={name='bart_loan_model', replace=true};
13RUN;
14QUIT;
3
Check the created output and model store tables.
Copied!
1PROC CAS;
2 TABLE.tableInfo TABLE={name='customer_response_preds'};
3 TABLE.tableInfo TABLE={name='bart_loan_model'};
4RUN;
5QUIT;

Expected Result


The action should successfully train a model and produce fit statistics for both training and testing partitions. A CAS table 'customer_response_preds' will be created containing the predicted probabilities for each customer. A model store table 'bart_loan_model' will also be created in the active caslib, ready for use with the bartScore action.