@@ -361,21 +361,22 @@ def evaluate_intents(intent_results,
361
361
# log and save misclassified samples to file for debugging
362
362
collect_nlu_errors (intent_results , errors_filename )
363
363
364
- from sklearn .metrics import confusion_matrix
365
- from sklearn .utils .multiclass import unique_labels
366
- import matplotlib .pyplot as plt
367
-
368
- cnf_matrix = confusion_matrix (targets , predictions )
369
- labels = unique_labels (targets , predictions )
370
- plot_confusion_matrix (cnf_matrix , classes = labels ,
371
- title = 'Intent Confusion matrix' ,
372
- out = confmat_filename )
373
- plt .show ()
374
-
375
- plot_intent_confidences (intent_results ,
376
- intent_hist_filename )
377
-
378
- plt .show ()
364
+ if confmat_filename :
365
+ from sklearn .metrics import confusion_matrix
366
+ from sklearn .utils .multiclass import unique_labels
367
+ import matplotlib .pyplot as plt
368
+
369
+ cnf_matrix = confusion_matrix (targets , predictions )
370
+ labels = unique_labels (targets , predictions )
371
+ plot_confusion_matrix (cnf_matrix , classes = labels ,
372
+ title = 'Intent Confusion matrix' ,
373
+ out = confmat_filename )
374
+ plt .show ()
375
+
376
+ plot_intent_confidences (intent_results ,
377
+ intent_hist_filename )
378
+
379
+ plt .show ()
379
380
380
381
predictions = [
381
382
{
0 commit comments