Multi-Intent classification

I have been reading the code for the tensorflow pipeline, and it seems to me that the only difference between doing this (say the intent_split_symbol is “+”):

intent:play

  • I want to play

intent:run

  • I want to run

intent:play+run

  • I want to run and play

and this:

intent:play

  • I want to play

intent:run

  • I want to run

intent:play_and_run

  • I want to run and play

is that instead of having this matrix identifying the intents

[ 1 0 0 ]

[ 0 1 0 ]

[ 0 0 1 ]

like in the second case, you have

[ 1 0 1 ]

[ 0 1 1 ]

in the first case (I am referring to the _create_encoded_intents function in the embedding_intent_classifier.py file in rasa_nlu/classifiers; if someone could tell me how to link to a function in the library here, that would be great!).

But what do we actually win by doing this? Sure we can add the values corresponding to the intents, but is there something more to the tensorflow_embedding classifier that I am not seeing? How does it actually learn to tell <<that even though the word “play” is in the sentence “I want to run and play”, this should be the intent “play+run” and not “play”>> in a different way than if I created three intents for it? The way I see it, we just mapped three intents in a two-dimensional space instead of a three-dimensional one, but the neural net should end up trying to do exactly the same AI logic.

Maybe there’s a piece of code I overlooked that does some clever trick that is actually more useful? (I am hoping this is the case.)

Essentially the reason why I ask is because when I saw multi-intent classification showing up, for me it meant giving up my spacy model, and my spacy model is performing extremely well, so if I can do three intents as in the above mocked example instead of doing two intents and a third one with a plus in the middle, I don’t see why I would switch, but if the tensorflow pipeline has something actually new to offer, then I would consider it (and note: I am craving for a good multi-intent solution, so I am really curious!).

Cheers everyone!

1 Like