Skip to content

Visual improvements for ROC and precision-recall plots #25929

Open
@stephanecollot

Description

@stephanecollot

Describe the workflow you want to enable

Hello,

I would like to suggest the following improvements:

Describe your proposed solution

Hello,

While working on ROC and precision-recall plots, I came up with the following suggestions:

  1. Add x and y axis limit: [0, 1], in sklearn axes currently start at ~-0.1
  2. Modify the plotting frame: either remove the top and right lines to see the curve better when values are close to 1, or plot the frame with a dotted line
  3. Fix aspect ratio to squared, since the two axes are the same scale.
  4. Add title
        ax.set_xlim((-0.01, 1.01))
        ax.set_ylim((-0.01, 1.01))
        for s in ['right', 'left', 'top', 'bottom']:
            ax.spines[s].set_visible(False)
        ax.axvline(1, color='black', linewidth=0.5, ls='dotted')
        ax.axhline(1, color='black', linewidth=0.5, ls='dotted')
        ax.axvline(0, color='black', linewidth=0.5, ls='dotted')
        ax.axhline(0, color='black', linewidth=0.5, ls='dotted')
        ax.set_aspect(1)
        ax.set_title(f'Precision-Recall Curve')

Example 1 Edge case

PR

Before:
image

After:
image

ROC

Before:
image

After:
image

Example 2 - Edge case

PR

Before:
image

After:
image

ROC

Before:
image

After:
image

Describe alternatives you've considered, if relevant

No response

Additional context

No response

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions