-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use response selector keys for confusion matrix labelling #7423
Changes from 5 commits
91ff6af
c81ffcb
35fdb52
c198393
0f3642e
021bcb1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Use response selector keys (sub-intents) as labels for plotting the confusion matrix during NLU evaluation to improve readability. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,6 +31,7 @@ | |
ENTITY_ATTRIBUTE_TYPE, | ||
ENTITY_ATTRIBUTE_GROUP, | ||
ENTITY_ATTRIBUTE_ROLE, | ||
RESPONSE_KEY_ATTRIBUTE, | ||
) | ||
from rasa.model import get_model | ||
from rasa.nlu import config, training_data, utils | ||
|
@@ -62,7 +63,7 @@ | |
|
||
ResponseSelectionEvaluationResult = namedtuple( | ||
"ResponseSelectionEvaluationResult", | ||
"intent_target " "response_target " "response_prediction " "message " "confidence", | ||
"intent_target response_key response_target response_prediction_full_intent response_prediction message confidence", | ||
) | ||
|
||
EntityEvaluationResult = namedtuple( | ||
|
@@ -373,7 +374,7 @@ def evaluate_response_selections( | |
) | ||
|
||
target_responses, predicted_responses = _targets_predictions_from( | ||
response_selection_results, "response_target", "response_prediction" | ||
response_selection_results, "response_key", "response_prediction_full_intent" | ||
) | ||
|
||
if report_folder: | ||
|
@@ -1050,12 +1051,24 @@ def get_eval_data( | |
response_prediction_key, {} | ||
).get(OPEN_UTTERANCE_PREDICTION_KEY, {}) | ||
|
||
response_prediction_full_intent = selector_properties.get( | ||
response_prediction_key, {} | ||
).get("full_retrieval_intent", {}) | ||
|
||
if isinstance(response_prediction_full_intent, str): | ||
response_prediction_full_intent = response_prediction_full_intent.split( | ||
"/" | ||
)[1] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would suggest not splitting the predicted |
||
|
||
response_target = example.get("response", "") | ||
response_key = example.get(RESPONSE_KEY_ATTRIBUTE, "") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Following from the above comment, this would then change to |
||
|
||
response_selection_results.append( | ||
ResponseSelectionEvaluationResult( | ||
intent_target, | ||
response_key, | ||
response_target, | ||
response_prediction_full_intent, | ||
response_prediction.get("name"), | ||
result.get("text", {}), | ||
response_prediction.get("confidence"), | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like with this change we can also get rid of
intent_target
,response_target
andresponse_prediction
. Can you scrub those off as well? There will be some more places where you will have to make changes.