Skip to Content
0

PAL Random Forest logic to identify high risk customer

Apr 16 at 02:00 PM

24

avatar image

1 Using Random forest Algorithm I would like to identify high risk customer example when utility usage level high, Credit risk number is high,Number of late fees paid is more, I would like to flag the customer as high-risk customer.

SET SCHEMA DM_PAL; DROP TYPE PAL_RF_SCORING_DATA_T; CREATE TYPE PAL_RF_SCORING_DATA_T AS TABLE( "CONTRACT_ID" INTEGER, "TEMPDIFF" VARCHAR(20), "CREDITRISK_RANK" INTEGER, "LATEFEE_PAID" DOUBLE, "IS_RISK" VARCHAR(10) ); DROP TYPE PAL_RF_SCORING_MODEL_T; CREATE TYPE PAL_RF_SCORING_MODEL_T AS TABLE( "ID" INTEGER, "TREEINDEX" INTEGER, "MODEL" VARCHAR(5000) ); DROP TYPE PAL_RF_SCORING_RESULT_T; CREATE TYPE PAL_RF_SCORING_RESULT_T AS TABLE("ID" INTEGER, "SCORING" VARCHAR(50), "PROB" DOUBLE); DROP TYPE PAL_CONTROL_T; CREATE TYPE PAL_CONTROL_T AS TABLE( "NAME" VARCHAR(100), "INTARGS" INTEGER, "DOUBLEARGS" DOUBLE, "STRINGARGS" VARCHAR(100) ); DROP TABLE PAL_RF_SCORING_PDATA_TBL; CREATE COLUMN TABLE PAL_RF_SCORING_PDATA_TBL ( "POSITION" INT, "SCHEMA_NAME" NVARCHAR(256), "TYPE_NAME" NVARCHAR(256), "PARAMETER_TYPE" VARCHAR(7) ); INSERT INTO PAL_RF_SCORING_PDATA_TBL VALUES (1, 'DM_PAL', 'PAL_RF_SCORING_DATA_T', 'IN'); INSERT INTO PAL_RF_SCORING_PDATA_TBL VALUES (2, 'DM_PAL', 'PAL_CONTROL_T', 'IN'); INSERT INTO PAL_RF_SCORING_PDATA_TBL VALUES (3, 'DM_PAL', 'PAL_RF_SCORING_MODEL_T', 'IN'); INSERT INTO PAL_RF_SCORING_PDATA_TBL VALUES (4, 'DM_PAL', 'PAL_RF_SCORING_RESULT_TBL', 'OUT'); CALL "SYS".AFLLANG_WRAPPER_PROCEDURE_DROP('DM_PAL', 'PAL_RF_SCORING_PROC'); CALL "SYS".AFLLANG_WRAPPER_PROCEDURE_CREATE('AFLPAL', 'RANDOMFORESTSCORING', 'DM_PAL', 'PAL_RF_SCORING_PROC', PAL_RF_SCORING_PDATA_TBL); DROP TABLE #PAL_CONTROL_TBL; CREATE LOCAL TEMPORARY COLUMN TABLE #PAL_CONTROL_TBL ( "NAME" VARCHAR(100), "INTARGS" INTEGER, "DOUBLEARGS" DOUBLE, "STRINGARGS" VARCHAR(100) ); INSERT INTO #PAL_CONTROL_TBL VALUES ('THREAD_NUMBER', 20, null,null); INSERT INTO #PAL_CONTROL_TBL VALUES ('VERBOSE', 0, null, null); DROP TABLE PAL_RF_SCORING_DATA_TBL; CREATE COLUMN TABLE PAL_RF_SCORING_DATA_TBL LIKE PAL_RF_SCORING_DATA_T; INSERT INTO PAL_RF_SCORING_DATA_TBL VALUES (0, 'LT', 10, 12, 'Yes'); INSERT INTO PAL_RF_SCORING_DATA_TBL VALUES (1, 'LT', 10, 11, 'Yes'); INSERT INTO PAL_RF_SCORING_DATA_TBL VALUES (2, 'HT', 1, 1, 'No'); INSERT INTO PAL_RF_SCORING_DATA_TBL VALUES (3, 'HT', 1, 1, 'No'); INSERT INTO PAL_RF_SCORING_DATA_TBL VALUES (4, 'LT', 10, 11, 'Yes'); INSERT INTO PAL_RF_SCORING_DATA_TBL VALUES (5, 'LT', 10, 11, 'Yes'); INSERT INTO PAL_RF_SCORING_DATA_TBL VALUES (6, 'HT', 1, 1, 'No'); DROP TABLE PAL_RF_SCORING_RESULT_TBL; CREATE COLUMN TABLE PAL_RF_SCORING_RESULT_TBL LIKE PAL_RF_SCORING_RESULT_T; CALL "DM_PAL".PAL_RF_SCORING_PROC(PAL_RF_SCORING_DATA_TBL, #PAL_CONTROL_TBL, PAL_RF_MODEL_TBL, PAL_RF_SCORING_RESULT_TBL) with OVERVIEW; SELECT * FROM PAL_RF_SCORING_RESULT_TBL;

But result out put is blank . please advise

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Vinoo Gan Apr 17 at 02:26 PM
0

Fixed.

Share
10 |10000 characters needed characters left characters exceeded