
DO BEGIN
declare header "SAP_PA_APL"."sap.pa.apl.base::BASE.T.FUNCTION_HEADER";
declare config "SAP_PA_APL"."sap.pa.apl.base::BASE.T.OPERATION_CONFIG_EXTENDED";
declare debrief_config "SAP_PA_APL"."sap.pa.apl.base::BASE.T.OPERATION_CONFIG_EXTENDED";
declare var_desc "SAP_PA_APL"."sap.pa.apl.base::BASE.T.VARIABLE_DESC_OID";
declare var_role "SAP_PA_APL"."sap.pa.apl.base::BASE.T.VARIABLE_ROLES_WITH_COMPOSITES_OID";
:header.insert(('Oid', '#42'));
:header.insert(('LogLevel', '8'));
:header.insert(('ModelFormat', 'bin'));
:config.insert(('APL/ModelType', 'regression',null));
:config.insert(('APL/NumberOfJobs', '4',null));
:config.insert(('APL/MaxIterations', '200',null));
:config.insert(('APL/MaxDepth', '4',null));
:config.insert(('APL/EarlyStoppingPatience', '20',null));
:config.insert(('APL/EvalMetric', 'RMSE',null));
:var_role.insert(('age', 'target', null, null, null));
-- create and train a model'
"SAP_PA_APL"."sap.pa.apl.base::CREATE_MODEL_AND_TRAIN"(:header, :config, :var_desc, :var_role, 'USER_APL','ADULT01', out_model, out_log, out_sum, out_indic);
-- Generate debrief tables
"SAP_PA_APL"."sap.pa.apl.base::GET_MODEL_DEBRIEF"(:header, :out_model, :debrief_config, out_debrief_metric,out_debrief_property, out_summ);
-- Use Debrief tables
-- Dump Report about continuous variables and their statistics
select * from "SAP_PA_APL"."sap.pa.apl.debrief.report::Statistics_ContinuousVariables"(:out_debrief_property, :out_debrief_metric);
END;
SELECT * FROM "SAP_PA_APL"."sap.pa.apl.debrief.report::<report_name>"
| Report name | Description |
| ClassificationRegression_VariablesContribution | Lists the variables by their contribution to explain the target |
| ClassificationRegression_VariablesCorrelation | Lists the pairs of correlated variables |
| ClassificationRegression_VariablesExclusion | Lists the excluded variables together with the reason for their exclusion |
| ContinuousTarget_CrossStatistics | Provides descriptive statistics for the continuous target by category for each variable and partition |
| ContinuousTarget_GroupCrossStatistics | Provides descriptive statistics for the continuous target by group for each variable and partition |
| ContinuousTarget_Statistics | Provides descriptive statistics for the continuous target |
| Statistics_CategoryFrequencies | Lists the category frequencies for each variable and partition |
| Statistics_ContinuousVariables | Lists the continuous variables with their descriptive statistics |
| Statistics_GroupFrequencies | Lists the group frequencies for each variable and partition |
| Statistics_Partition | Lists the partitions that were built from the training dataset |
| Statistics_Variables | Lists all variables in the model together with their roles |
DO BEGIN
declare header "SAP_PA_APL"."sap.pa.apl.base::BASE.T.FUNCTION_HEADER";
declare config "SAP_PA_APL"."sap.pa.apl.base::BASE.T.OPERATION_CONFIG_EXTENDED";
declare debrief_config "SAP_PA_APL"."sap.pa.apl.base::BASE.T.OPERATION_CONFIG_EXTENDED";
declare var_desc "SAP_PA_APL"."sap.pa.apl.base::BASE.T.VARIABLE_DESC_OID";
declare var_role "SAP_PA_APL"."sap.pa.apl.base::BASE.T.VARIABLE_ROLES_WITH_COMPOSITES_OID";
:header.insert(('Oid', '#42'));
:header.insert(('LogLevel', '8'));
:header.insert(('ModelFormat', 'bin'));
:config.insert(('APL/ModelType', 'regression',null));
:config.insert(('APL/NumberOfJobs', '4',null));
:config.insert(('APL/MaxIterations', '200',null));
:config.insert(('APL/MaxDepth', '4',null));
:config.insert(('APL/EarlyStoppingPatience', '20',null));
:config.insert(('APL/EvalMetric', 'RMSE',null));
:var_role.insert(('age', 'target', null, null, null));
-- create and train a model'
"SAP_PA_APL"."sap.pa.apl.base::CREATE_MODEL_AND_TRAIN"(:header, :config, :var_desc, :var_role, 'USER_APL','ADULT01', out_model, out_log, out_sum, out_indic);
-- Generate debrief tables
"SAP_PA_APL"."sap.pa.apl.base::GET_MODEL_DEBRIEF"(:header, :out_model, :debrief_config, out_debrief_metric,out_debrief_property, out_summ);
-- Query Debrief tables
SELECT * FROM "SAP_PA_APL"."sap.pa.apl.debrief.report::ClassificationRegression_VariablesContribution"(:out_debrief_property, :out_debrief_metric)
order by "Rank";
SELECT * FROM "SAP_PA_APL"."sap.pa.apl.debrief.report::ClassificationRegression_VariablesCorrelation"(:out_debrief_property, :out_debrief_metric)
order by "Correlation Coefficient" desc;
SELECT * FROM "SAP_PA_APL"."sap.pa.apl.debrief.report::ClassificationRegression_VariablesExclusion"(:out_debrief_property, :out_debrief_metric);
SELECT * FROM "SAP_PA_APL"."sap.pa.apl.debrief.report::ContinuousTarget_CrossStatistics"(:out_debrief_property, :out_debrief_metric)
WHERE "Partition" = 'Estimation'
order by "Variable", to_varchar("Category");
SELECT * FROM "SAP_PA_APL"."sap.pa.apl.debrief.report::ContinuousTarget_GroupCrossStatistics"(:out_debrief_property, :out_debrief_metric)
WHERE "Partition" = 'Estimation'
order by "Variable", "Weight" desc;
SELECT * FROM "SAP_PA_APL"."sap.pa.apl.debrief.report::ContinuousTarget_Statistics"(:out_debrief_property, :out_debrief_metric);
SELECT * FROM "SAP_PA_APL"."sap.pa.apl.debrief.report::Statistics_CategoryFrequencies"(:out_debrief_property, :out_debrief_metric)
order by "Weight" desc;
SELECT * FROM "SAP_PA_APL"."sap.pa.apl.debrief.report::Statistics_ContinuousVariables"(:out_debrief_property, :out_debrief_metric);
SELECT * FROM "SAP_PA_APL"."sap.pa.apl.debrief.report::Statistics_GroupFrequencies"(:out_debrief_property, :out_debrief_metric)
order by "Weight" desc;
SELECT * FROM "SAP_PA_APL"."sap.pa.apl.debrief.report::Statistics_Partition"(:out_debrief_property, :out_debrief_metric);
SELECT * FROM "SAP_PA_APL"."sap.pa.apl.debrief.report::Statistics_Variables"(:out_debrief_property, :out_debrief_metric);
END;


DO BEGIN
declare header "SAP_PA_APL"."sap.pa.apl.base::BASE.T.FUNCTION_HEADER";
declare config "SAP_PA_APL"."sap.pa.apl.base::BASE.T.OPERATION_CONFIG_EXTENDED";
declare var_desc "SAP_PA_APL"."sap.pa.apl.base::BASE.T.VARIABLE_DESC_OID";
declare var_role "SAP_PA_APL"."sap.pa.apl.base::BASE.T.VARIABLE_ROLES_WITH_COMPOSITES_OID";
declare tabletype_config "SAP_PA_APL"."sap.pa.apl.base::BASE.T.OPERATION_CONFIG_EXTENDED";
:header.insert(('Oid', '#42'));
:header.insert(('LogLevel', '8'));
:header.insert(('ModelFormat', 'bin'));
:config.insert(('APL/ModelType', 'regression',null));
:config.insert(('APL/NumberOfJobs', '4',null));
:config.insert(('APL/MaxIterations', '200',null));
:config.insert(('APL/MaxDepth', '4',null));
:config.insert(('APL/EarlyStoppingPatience', '20',null));
:config.insert(('APL/EvalMetric', 'RMSE',null));
:var_role.insert(('age', 'target', null, null, null));
-- create and train a model'
"SAP_PA_APL"."sap.pa.apl.base::CREATE_MODEL_AND_TRAIN"(:header, :config, :var_desc, :var_role, 'USER_APL','ADULT01', out_model, out_log, out_sum, out_indic);
-- retrieve table type for apply function
:tabletype_config.insert(('APL/ModelType', 'regression', null));
:tabletype_config.insert(('APL/ApplyExtraMode', 'Advanced Apply Settings', null));
:tabletype_config.insert(('APL/ApplyReasonCode/TopCount', '5', null));
"SAP_PA_APL"."sap.pa.apl.base::GET_TABLE_TYPE_FOR_APPLY"(:header, :out_model, :tabletype_config, 'USER_APL', 'ADULT01', out_schema, out_log);
SELECT * from :out_schema;
END;

create table "USER_APL"."ADULT01_APPLY" (
"KxIndex" BIGINT,
"age" INTEGER,
"gb_score_age" BIGINT,
"gb_reason_top_1_name" VARCHAR(5000),
"gb_reason_top_1_value" NVARCHAR(5000),
"gb_reason_top_1_strength_indicator" NVARCHAR(5000),
"gb_reason_top_2_name" NVARCHAR(5000),
"gb_reason_top_2_value" NVARCHAR(5000),
"gb_reason_top_2_strength_indicator" NVARCHAR(5000),
"gb_reason_top_3_name" NVARCHAR(5000),
"gb_reason_top_3_value" NVARCHAR(5000),
"gb_reason_top_3_strength_indicator" NVARCHAR(5000),
"gb_reason_top_4_name" NVARCHAR(5000),
"gb_reason_top_4_value" NVARCHAR(5000),
"gb_reason_top_4_strength_indicator" NVARCHAR(5000),
"gb_reason_top_5_name" NVARCHAR(5000),
"gb_reason_top_5_value" NVARCHAR(5000),
"gb_reason_top_5_strength_indicator" NVARCHAR(5000)
);
create table "USER_APL"."ADULT01_NEW" as ( SELECT * FROM "USER_APL"."ADULT01" );
truncate table "USER_APL"."ADULT01_NEW";
INSERT INTO ADULT01_NEW("workclass", "fnlwgt", "education", "education-num", "marital-status", "occupation", "relationship", "race", "s3x", "capital-gain", "capital-loss", "hours-per-week", "native-country", "class")
VALUES('Private', 164000, 'Masters', 9, 'Never-married', 'Sales', 'Husband', 'White', 'Male', 0, 0, 40, 'United-States', 0);
INSERT INTO ADULT01_NEW("workclass", "fnlwgt", "education", "education-num", "marital-status", "occupation", "relationship", "race", "s3x", "capital-gain", "capital-loss", "hours-per-week", "native-country", "class")
VALUES('Self-emp-inc', 250000, 'HS-grad', 10, 'Married-civ-spouse', 'Prof-specialty', 'Husband', 'Black', 'Male', 0, 0, 40, 'United-States', 0);
DO BEGIN
declare header "SAP_PA_APL"."sap.pa.apl.base::BASE.T.FUNCTION_HEADER";
declare config "SAP_PA_APL"."sap.pa.apl.base::BASE.T.OPERATION_CONFIG_EXTENDED";
declare var_desc "SAP_PA_APL"."sap.pa.apl.base::BASE.T.VARIABLE_DESC_OID";
declare var_role "SAP_PA_APL"."sap.pa.apl.base::BASE.T.VARIABLE_ROLES_WITH_COMPOSITES_OID";
declare tabletype_config "SAP_PA_APL"."sap.pa.apl.base::BASE.T.OPERATION_CONFIG_EXTENDED";
:header.insert(('Oid', '#42'));
:header.insert(('LogLevel', '8'));
:header.insert(('ModelFormat', 'bin'));
:config.insert(('APL/ModelType', 'regression',null));
:config.insert(('APL/NumberOfJobs', '4',null));
:config.insert(('APL/MaxIterations', '200',null));
:config.insert(('APL/MaxDepth', '4',null));
:config.insert(('APL/EarlyStoppingPatience', '20',null));
:config.insert(('APL/EvalMetric', 'RMSE',null));
:var_role.insert(('age', 'target', null, null, null));
-- create and train a model'
"SAP_PA_APL"."sap.pa.apl.base::CREATE_MODEL_AND_TRAIN"(:header, :config, :var_desc, :var_role, 'USER_APL','ADULT01', out_model, out_log, out_sum, out_indic);
-- retrieve table type for apply function
:tabletype_config.insert(('APL/ModelType', 'regression', null));
:tabletype_config.insert(('APL/ApplyExtraMode', 'Advanced Apply Settings', null));
:tabletype_config.insert(('APL/ApplyReasonCode/TopCount', '5', null));
TRUNCATE TABLE "USER_APL"."ADULT01_APPLY";
"SAP_PA_APL"."sap.pa.apl.base::APPLY_MODEL"(:header, :out_model, :tabletype_config, 'USER_APL', 'ADULT01_NEW', 'USER_APL', 'ADULT01_APPLY', out_log, out_summary);
SELECT * FROM "USER_APL"."ADULT01_APPLY";
END;


You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 15 | |
| 9 | |
| 7 | |
| 6 | |
| 6 | |
| 6 | |
| 5 | |
| 4 | |
| 3 | |
| 3 |