Skip to Content
0

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

Jul 04, 2017 at 08:53 AM

95

avatar image
Former Member

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?

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

4 Answers

Best Answer
Marc DANIAU
Jul 24, 2017 at 12:26 PM
0

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


Share
10 |10000 characters needed characters left characters exceeded
Antoine CHABERT
Jul 05, 2017 at 08:43 AM
0

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.

Show 5 Share
10 |10000 characters needed characters left characters exceeded
Former Member

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

0

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

0
Former Member

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?

0

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

0

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/KeyInfluencers

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

Otherwise scripting maybe?

0
Antoine CHABERT
Jul 04, 2017 at 12:39 PM
0

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

Show 1 Share
10 |10000 characters needed characters left characters exceeded
Former Member

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

0
Antoine CHABERT
Jul 04, 2017 at 02:24 PM
0

Hi Torge,

Let me think about this and come back to you.

Kind regards

Antoine

Share
10 |10000 characters needed characters left characters exceeded