Skip to content

Commit

Permalink
UPD: beautify
Browse files Browse the repository at this point in the history
  • Loading branch information
Candice Moyet committed Aug 1, 2023
1 parent c691c53 commit f9b90c9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ def plot_intervals(X, y, y_pred, intervals, title="", ax=None):
ax.legend()


def plot_coverage_by_width(y, intervals, num_bins, title="", ax=None):
def plot_coverage_by_width(y, intervals, num_bins, alpha, title="", ax=None):
"""
PLots a bar diagram of coverages by groups of interval widths.
Expand All @@ -251,6 +251,8 @@ def plot_coverage_by_width(y, intervals, num_bins, title="", ax=None):
Intervals of prediction
num_bins: int
Number of groups of interval widths
alpha: float
The risk level
title: str
Title of the plot
ax: matplotlib axes
Expand All @@ -263,6 +265,7 @@ def plot_coverage_by_width(y, intervals, num_bins, title="", ax=None):
np.arange(num_bins),
regression_ssc(y, intervals, num_bins=num_bins)[0]
)
ax.axhline(y=1 - alpha, color='r', linestyle='-')
ax.set_title(title)
ax.set_xlabel("intervals grouped by size")
ax.set_ylabel("coverage")
Expand All @@ -288,7 +291,7 @@ def plot_coverage_by_width(y, intervals, num_bins, title="", ax=None):
)
plot_coverage_by_width(
y_test, intervals[strategy],
num_bins=num_bins, title=strategy, ax=ax_hist
num_bins=num_bins, alpha=alpha, title=strategy, ax=ax_hist
)

ax_distr.hist(
Expand Down
2 changes: 1 addition & 1 deletion examples/regression/4-tutorials/plot_crf_tutorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@


##############################################################################
# 1. Models
# 2. Models
# --------------------------------------------------------------------------
# We will now define 4 different ways of using the CRF score. Remember that the
# CRF score is only available in the split setup. First, the simplest one
Expand Down

0 comments on commit f9b90c9

Please sign in to comment.