Skip to Content
avatar image
Former Member

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

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?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    Jul 24, 2017 at 12:26 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • Jul 05, 2017 at 08:43 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • Jul 04, 2017 at 12:39 PM

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

    Add comment
    10|10000 characters needed 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

  • Jul 04, 2017 at 02:24 PM

    Hi Torge,

    Let me think about this and come back to you.

    Kind regards

    Antoine

    Add comment
    10|10000 characters needed characters exceeded