cancel
Showing results for 
Search instead for 
Did you mean: 

Is there any way to export feature importance from SAP BO Predictive Analytics?

Former Member
0 Kudos

Hi,

we have created a classification model in SAP BO predictive analytics (dektop). For visualization we want to export the feature importance (maybe in an HANA DB) including corresponding values of the intervals.

So here is my question: is there any way to export the described values?

Accepted Solutions (1)

Accepted Solutions (1)

marc_daniau
Advisor
Advisor
0 Kudos

From SAP Predictive Analytics desktop, save the classification model in table: MODEL_TRAIN_DESKTOP within HANA.

From HANA Studio, prepare the signature of the APL function : get_model_info for a model in Native format

drop table GET_MODEL_INFO_SIGNATURE;
create column table GET_MODEL_INFO_SIGNATURE like PROCEDURE_SIGNATURE_T;
insert into GET_MODEL_INFO_SIGNATURE values (1, 'USER_APL','FUNCTION_HEADER_T', 'IN');
insert into GET_MODEL_INFO_SIGNATURE values (2, 'USER_APL','MODEL_NATIVE_T', 'IN');   --- Native format
insert into GET_MODEL_INFO_SIGNATURE values (3, 'USER_APL','OPERATION_CONFIG_T', 'IN');
insert into GET_MODEL_INFO_SIGNATURE values (4, 'USER_APL','SUMMARY_T', 'OUT');
insert into GET_MODEL_INFO_SIGNATURE values (5, 'USER_APL','VARIABLE_ROLES_WITH_COMPOSITES_OID_T', 'OUT');
insert into GET_MODEL_INFO_SIGNATURE values (6, 'USER_APL','VARIABLE_DESC_OID_T', 'OUT');
insert into GET_MODEL_INFO_SIGNATURE values (7, 'USER_APL','INDICATORS_T', 'OUT');
insert into GET_MODEL_INFO_SIGNATURE values (8, 'USER_APL','PROFITCURVE_T', 'OUT');

call SYS.AFLLANG_WRAPPER_PROCEDURE_DROP('USER_APL','APLWRAPPER_GET_MODEL_INFO');
call SYS.AFLLANG_WRAPPER_PROCEDURE_CREATE('APL_AREA','GET_MODEL_INFO','USER_APL', 'APLWRAPPER_GET_MODEL_INFO', GET_MODEL_INFO_SIGNATURE);

Specify the model format in the function header, and run the APL function : get_model_info

drop table FUNC_HEADER;
create table FUNC_HEADER like FUNCTION_HEADER_T;
insert into FUNC_HEADER values ('Oid', '#42');
insert into FUNC_HEADER values ('LogLevel', '8');
insert into FUNC_HEADER values ('ModelFormat', 'native');
drop table OPERATION_CONFIG;
create table OPERATION_CONFIG like OPERATION_CONFIG_T;
drop table SUMMARY;
create table SUMMARY like SUMMARY_T;
drop table VARIABLE_DESC;
create table VARIABLE_DESC like VARIABLE_DESC_OID_T;
drop table VARIABLE_ROLES;
create table VARIABLE_ROLES like VARIABLE_ROLES_WITH_COMPOSITES_OID_T;
drop table INDICATORS;
create table INDICATORS like INDICATORS_T;
drop table PROFITCURVES;
create table PROFITCURVES like PROFITCURVE_T;

call APLWRAPPER_GET_MODEL_INFO (
FUNC_HEADER, MODEL_TRAIN_DESKTOP, 
OPERATION_CONFIG, SUMMARY, VARIABLE_ROLES, VARIABLE_DESC, INDICATORS, PROFITCURVES 
) with overview;

Extract variables importance from APL table : INDICATORS

select 
 OID ,
 row_number() OVER (partition by OID order by to_double(VALUE) desc) as "Rank",
 VARIABLE as "Explanatory Variable", 
 round(to_double(VALUE) *100 , 2) as "Individual Contribution",
 round(sum(to_double(VALUE)) OVER (partition by OID order by to_double(VALUE) desc) *100 ,2) as "Cumulative Contribution"
from 
 INDICATORS 
where 
 KEY = 'MaximumSmartVariableContribution'
order by 4 desc;

Sample Results

Answers (3)

Answers (3)

achab
Product and Topic Expert
Product and Topic Expert
0 Kudos

Just for further clarification: is this about "seeing" the plot? In Factory you will be able to do this with our soon to be released version 3.2. I'll attach a screenshot.

Former Member
0 Kudos

We want to get the data to create the plot. Kind regards Torge

achab
Product and Topic Expert
Product and Topic Expert
0 Kudos

In Automated Analytics you can export the contributions to Excel - there you can get the data.

Former Member
0 Kudos

I´ve already seen that. If i am not wrong we have to export each section manually what takes too long time because we have to do the export after every training of a new model. Or is there any way to export the entire contributions at once?

achab
Product and Topic Expert
Product and Topic Expert
0 Kudos

True, I am still looking for other ways. Stay tuned!

achab
Product and Topic Expert
Product and Topic Expert
0 Kudos

Maybe this could be a way? (SAP Cloud Platform Predictive Service - Key Influencer)

https://help.hana.ondemand.com/c4pa/frameset.htm?e8bda9b653ff4b48a702124e27747f85.html

https://demo-aa2945a00.dispatcher.hana.ondemand.com/webapp/index.html?hc_reset#/features/KeyInfluenc...

I understand desktop export would be ideal but I do not have a solution from the user interface.

Otherwise scripting maybe?

achab
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Torge,

Let me think about this and come back to you.

Kind regards

Antoine

achab
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Torge, can you please explain why you need to do this? Kind regards Antoine

Former Member
0 Kudos

Hello Antoine,

we want to visualize the feature importance in a polar plot. The featrures are about customer attributes. The plot is a requirement from one of our customers. Through the plot he wants to get insights about relevant informations from churning customers.

Kind regards,

Torge