DistrictDataLabs / yellowbrick

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

Classification report shows classes inverted if passed from sklearn label encoder #1313

Open alessandrofilisetti opened 6 months ago

alessandrofilisetti commented 6 months ago

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):