Skip to content

Commit

Permalink
🐛 Fix #99 error in calibration plots
Browse files Browse the repository at this point in the history
  • Loading branch information
o-laurent committed Jun 6, 2024
1 parent 63fb874 commit acbd582
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions tests/metrics/classification/test_calibration.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ def test_plot_binary(self) -> None:
torch.as_tensor([0, 0, 1, 1, 1]),
)
fig, ax = metric.plot()
metric.plot(ax=ax)
assert isinstance(fig, plt.Figure)
assert isinstance(ax, plt.Axes)
assert ax.get_xlabel() == "Top-class Confidence (%)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ def _ce_plot(self, ax: _AX_TYPE | None = None) -> _PLOT_OUT_TYPE:
ax.set_xlim(0, 100)
ax.set_ylim(0, 100)
ax.set_aspect("equal", "box")
fig.tight_layout()
if fig is not None:
fig.tight_layout()
return fig, ax


Expand Down

0 comments on commit acbd582

Please sign in to comment.