DistrictDataLabs / yellowbrick

Visual analysis and diagnostic tools to facilitate machine learning model selection.
http://www.scikit-yb.org/
Apache License 2.0
4.3k stars 559 forks source link

Fixes #1246 Missing labels in classification_report #1247

Closed admo1 closed 2 years ago

admo1 commented 2 years ago

This PR fixes #1246 which reported a bug that caused a problem to occur when users are trying to plot a classifcation_report with labels that were present during training but are missing during scoring.

I have made the following changes:

  1. Added labels=self.classes_ argument to sklearn's precision_recall_fscore_support function that is called in the score function of the ClassificationReport class.

CHECKLIST

codecov[bot] commented 2 years ago

Codecov Report

Merging #1247 (968f060) into develop (d2bafd7) will increase coverage by 0.00%. The diff coverage is 100.00%.

@@           Coverage Diff            @@
##           develop    #1247   +/-   ##
========================================
  Coverage    90.61%   90.62%           
========================================
  Files           92       92           
  Lines         5213     5214    +1     
========================================
+ Hits          4724     4725    +1     
  Misses         489      489           
Impacted Files Coverage Δ
yellowbrick/classifier/classification_report.py 95.65% <100.00%> (+0.04%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update d2bafd7...968f060. Read the comment docs.