yellowbrick icon indicating copy to clipboard operation
yellowbrick copied to clipboard

Classification report shows classes inverted if passed from sklearn label encoder

Open alessandrofilisetti opened this issue 1 year ago • 1 comments

Describe the bug The same classes passed through sklearn label encoder are shown inverted in classification report. I tried the same with confusion matrix and classes are correctly shown

To Reproduce


 # CLASSIFICATION REPORT
  visualizer = ClassificationReport(
      pipeline,
      classes = label_encoder.classes_,
      cmap="YlGn", 
      support=True
  )
  visualizer.fit(X_train, y_train)
  visualizer.score(X_test, y_test) 

  # CONFUSION MATRIX
  cm = ConfusionMatrix(
      pipeline, 
      classes= label_encoder.classes_,
      cmap='Greens'
  )
  
  cm.fit(X_train, y_train)
  cm.score(X_test, y_test)

Dataset Whatever dataset you prefer

Expected behavior Coherent classes visualization

Desktop (please complete the following information):

  • OS: Cloud Jupiter notebook
  • Python Version 3.11
  • Yellowbrick Version 1.5

alessandrofilisetti avatar May 09 '24 10:05 alessandrofilisetti