Interpretation Extension: retrieve model from repository

anaRodrigues
anaRodrigues New Altair Community Member
edited November 5 in Community Q&A
Hello,

I would like to generate a SHAP interpretation for a model I have stored in the repository. Is this possible? It doesn't seem to work.

<?xml version="1.0" encoding="UTF-8"?><process version="9.9.000">
  <context>
    <input/>
    <output/>
    <macros/>
  </context>
  <operator activated="true" class="process" compatibility="9.9.000" expanded="true" name="Process">
    <parameter key="logverbosity" value="init"/>
    <parameter key="random_seed" value="2001"/>
    <parameter key="send_mail" value="never"/>
    <parameter key="notification_email" value=""/>
    <parameter key="process_duration_for_mail" value="30"/>
    <parameter key="encoding" value="SYSTEM"/>
    <process expanded="true">
      <operator activated="true" class="retrieve" compatibility="9.9.000" expanded="true" height="68" name="Retrieve G_D_SVM-RFE_DT" width="90" x="246" y="34">
        <parameter key="repository_entry" value="//Local Repository/Models_SVM-RFE/G_D_SVM-RFE_DT"/>
      </operator>
      <operator activated="true" class="retrieve" compatibility="9.9.000" expanded="true" height="68" name="Retrieve gland_trainSet_stable" width="90" x="112" y="136">
        <parameter key="repository_entry" value="//Local Repository/gland_trainSet_stable"/>
      </operator>
      <operator activated="true" class="multiply" compatibility="9.9.000" expanded="true" height="103" name="Multiply" width="90" x="246" y="136"/>
      <operator activated="true" class="interpretation:generate_interpretation" compatibility="0.1.001" expanded="true" height="124" name="Generate Interpretation" width="90" x="447" y="85">
        <parameter key="algorithm" value="Shapley"/>
        <parameter key="sample_size" value="100"/>
        <parameter key="redraw_local_samples" value="true"/>
        <parameter key="explanation_algorithm" value="Correlation"/>
        <parameter key="locality" value="0.2"/>
        <parameter key="use_local_random_seed" value="false"/>
        <parameter key="local_random_seed" value="1992"/>
      </operator>
      <connect from_op="Retrieve G_D_SVM-RFE_DT" from_port="output" to_op="Generate Interpretation" to_port="mod"/>
      <connect from_op="Retrieve gland_trainSet_stable" from_port="output" to_op="Multiply" to_port="input"/>
      <connect from_op="Multiply" from_port="output 1" to_op="Generate Interpretation" to_port="training"/>
      <connect from_op="Multiply" from_port="output 2" to_op="Generate Interpretation" to_port="test"/>
      <connect from_op="Generate Interpretation" from_port="importance" to_port="result 1"/>
      <connect from_op="Generate Interpretation" from_port="global weights" to_port="result 2"/>
      <portSpacing port="source_input 1" spacing="0"/>
      <portSpacing port="sink_result 1" spacing="0"/>
      <portSpacing port="sink_result 2" spacing="0"/>
      <portSpacing port="sink_result 3" spacing="0"/>
    </process>
  </operator>
</process>


Thanks in advance,
Ana

Best Answer

  • anaRodrigues
    anaRodrigues New Altair Community Member
    Answer ✓
    Hi Martin,

    All regular attributes are type 'real' as they should be. I think the problem is that the model was trained with an example set that went through feature selection, so the sets of attributes are not the same. I didn't think this would be an issue because the 'apply model' operator works just fine when I input the test set with the full set of attributes.

    Do you know of any way to fix this?

    Thanks,
    Ana

Answers

  • MartinLiebig
    MartinLiebig
    Altair Employee
    Hi,
    whats the error message?
    Best,
    Martin
  • anaRodrigues
    anaRodrigues New Altair Community Member
    Hi Martin,

    Here it is.


    Thank you,
    Ana
  • MartinLiebig
    MartinLiebig
    Altair Employee
    thats not a problem on the model side. The data you want to have explained has a different type in application compare to training of the model.
    Can you check the type? Likely it moved to nominal but is a numerical?

    Best,
    Martin
  • anaRodrigues
    anaRodrigues New Altair Community Member
    Answer ✓
    Hi Martin,

    All regular attributes are type 'real' as they should be. I think the problem is that the model was trained with an example set that went through feature selection, so the sets of attributes are not the same. I didn't think this would be an issue because the 'apply model' operator works just fine when I input the test set with the full set of attributes.

    Do you know of any way to fix this?

    Thanks,
    Ana
  • MartinLiebig
    MartinLiebig
    Altair Employee
    Hi,
    i can only tell you what the operator shows you. And this is that this certain attribute is different to the training set. Usually a superset of your attributes should work well.
    For more details I would need to see the model and the exampleset.

    BR,
    Martin