Scénario de test & Cas d'usage
Classification utilisant des réseaux bayésiens.
Découvrir toutes les actions de bayesianNetClassifierCréation d'une table de clients avec des informations socio-démographiques, des indicateurs bancaires et une variable cible indiquant s'ils ont souscrit à l'offre précédente.
| 1 | DATA casuser.clients_marketing; |
| 2 | call streaminit(4321); |
| 3 | DO id_client = 1 to 2000; |
| 4 | age = 20 + rand('integer', 50); |
| 5 | IF age < 30 THEN csp = 'Etudiant'; |
| 6 | ELSE IF age < 50 THEN csp = 'Employe'; |
| 7 | ELSE csp = 'Retraite'; |
| 8 | revenu_annuel = 30000 + (age/10) * rand('uniform') * 20000; |
| 9 | nb_produits = 1 + rand('integer', 5); |
| 10 | /* Simulation de la cible */ |
| 11 | IF csp='Employe' and revenu_annuel > 50000 and nb_produits > 2 THEN souscrit = 'Oui'; |
| 12 | ELSE IF rand('uniform') < 0.25 THEN souscrit = 'Oui'; |
| 13 | ELSE souscrit = 'Non'; |
| 14 | OUTPUT; |
| 15 | END; |
| 16 | RUN; |
| 1 | PROC CASUTIL; |
| 2 | load DATA=casuser.clients_marketing outcaslib='casuser' casout='clients_marketing' replace; |
| 3 | RUN; |
| 4 | QUIT; |
| 1 | PROC CAS; |
| 2 | ACTION bayesianNetClassifier.bnet / |
| 3 | TABLE={name='clients_marketing', caslib='casuser'}, |
| 4 | target='souscrit', |
| 5 | inputs={{name='age'}, {name='csp'}, {name='revenu_annuel'}, {name='nb_produits'}}, |
| 6 | nominals={{name='csp'}, {name='souscrit'}}, |
| 7 | structures={'TAN'}, |
| 8 | partByFrac={validate=0.3, seed=54321}, |
| 9 | saveState={name='bnet_marketing_model', replace=true}; |
| 10 | RUN; |
| 11 | QUIT; |
L'action s'exécute avec succès. Les tables de résultats indiquent les performances du modèle sur l'échantillon de validation (ex: matrice de confusion, taux de mauvaise classification). Une table CAS nommée 'bnet_marketing_model' est créée dans la caslib 'casuser', contenant l'état du modèle prêt à être utilisé pour scorer de nouveaux clients.