PAIR-code / what-if-tool

Source code/webpage/demos for the What-If Tool
https://pair-code.github.io/what-if-tool
Apache License 2.0
907 stars 169 forks source link

What If on Tree data #177

Closed rupjit-bo closed 3 years ago

rupjit-bo commented 3 years ago

Awesome work on the library. I have discovered it recently and it seems to have a lot of good features. I wanted to try it out for tree structured data (Abstract Syntax Trees). I have trained a model called TBCNN. Now I want to check which nodes are the ones causing the prediction to be 1 or 0.

My data is stored as a list of dictionaries, where each (nested) dictionary represents a data point (specifically a tree)

[{'node': 'ci_root', 'children': [{'node': 'ci_class_decl', 'children': [{'node': 'ci_modifiers', 'children': [{'node': 'ci_modifier', 'children': []}]}, {'node': 'ci_type', 'children': [{'node': 'SimpleType', 'children': [{'node': 'SimpleName', 'children': []}]}]}, ... ] NOTE: This is just a part of one data point.

Also, in the data preprocessing part, I train a word2vec style network on the trees.

Is there any way in which I can use the tool to identify the nodes involved in the prediction.

Thank you

jameswex commented 3 years ago

The What-If Tool works well as a black-box model analysis tool, helping you understand how a model behaves with respect to its inputs. Unfortunately, doesn't have any features to support determining important nodes in a tree-based model.