Multiple Sentence Inputs
See original GitHub issueMy model takes 2 sentences as input, as well as a number of continuous values. The sentences are converted into 2 sentence vectors, operations are applied to them, and then are passed on to the next model along with the continuous values. This model then predicts semantic similarity (softmax) based on cosine distance between sentence vectors and the extra continuous valued features.
I would like to see if I can adapt parts of the LimeTextExplainer
in order to explain which parts of each sentence result in high semantic similarity.
Do you have any suggestions on where I should begin? Is it a viable idea? Any help would be appreciated
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Handling multiple sequences - Hugging Face Course
How do we handle multiple sequences of different lengths? Are vocabulary indices the only inputs that allow a model to work well? Is...
Read more >How to get multiple sentences as input in c++? - Stack Overflow
We have an assignment in c++ in which we have store information about multiple books(Author Name, Title, Publisher etc). While getting the title ......
Read more >Is it possible to take multiple sentences as commandline input?
For various reasons, I have to take multiple strings ( strings may include multiple words ) as command-line input.Say,
Read more >Learning to Generate Multiple Style Transfer ... - ACL Anthology
... that can convert an input sentence to multiple different output sentences, ... comparisons to several text style transfer approaches on multiple public ......
Read more >Learning to Generate Multiple Style Transfer Outputs for an ...
... convert an input sentence to multiple different output sentences, ... comparisons to several text style transfer approaches on multiple ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Oh, this is interesting - you have both text AND continuous features. If all you care about is explaining the text parts while keeping the continuous values fixed, it should be easy, as the only difference is that you have two sentences instead of one. What you would need to do in this case is to put both sentences in a string, separated by a character that is not caught by the split_expression parameter (see the initializer of LimeTextExplainer). You then could define a classifier_fn that takes whatever text LIME gives is, splits it into two sentences, computes the sentence vectors and etc. Your code would look something like this:
Then, if you wanted to explain a particular instance, you would have to do something like this:
You may have to be a bit creative if you want to use the visualizations we have, since the text displayed will have both sentences. Also, you have to think if it makes sense to use bow=True or False in this case. If you’re doing anything with sequences, I would say False makes more sense.
If you want to explain the impact of the words and the numerical features, you’ll have to write a function that perturbs both at the same time. If this is the case, you would want to do a mix of __data_labels_distances in lime_text.py and __data_inverse in lime_tabular.py.
Both are viable ideas, the second one is definitely a bit more work. I would be very interested to see what you end up with, I’ve never thought about this particular use case. If you are comfortable sharing what the application is, please tell me over email : ). Let me know if you have any more questions too.
Best,
Hi! I am conducting the same task as yours. But I find the final score of every token is similar. I think it’s incorrect. Could you please tell me how you complete it? More appreciate!!!