Skip to content

Plot rate curve

plot_rate_curve(x_values, y_values, plot_title='success_rate')

Plot success rate.

Y-axis is true positive rate and x-axis is proportion of area.

Parameters:

Name Type Description Default
x_values Union[ndarray, Series]

Proportion of area values.

required
y_values Union[ndarray, Series]

True positive rate values.

required
plot_title str

Success rate

'success_rate'

Returns:

Type Description
Figure

Matplotlib figure containing the produced plot.

Raises:

Type Description
InvalidParameterValueException

Invalid plot type.

InvalidParameterValueException

x_values or y_values are out of bounds.

Source code in eis_toolkit/evaluation/plot_rate_curve.py
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
@beartype
def plot_rate_curve(
    x_values: Union[np.ndarray, pd.Series],
    y_values: Union[np.ndarray, pd.Series],
    plot_title: str = "success_rate",
) -> matplotlib.figure.Figure:
    """Plot success rate.

    Y-axis is true positive rate and x-axis is proportion of area.

    Args:
        x_values: Proportion of area values.
        y_values: True positive rate values.
        plot_title: Success rate

    Returns:
        Matplotlib figure containing the produced plot.

    Raises:
        InvalidParameterValueException: Invalid plot type.
        InvalidParameterValueException: x_values or y_values are out of bounds.
    """
    label = plot_title
    xlab = "Proportion of area"

    if x_values.max() > 1 or x_values.min() < 0:
        raise InvalidParameterValueException("x_values should be within range 0-1")

    if y_values.max() > 1 or y_values.min() < 0:
        raise InvalidParameterValueException("y_values should be within range 0-1")

    fig = _plot_rate_curve(x_values=x_values, y_values=y_values, label=label, xlab=xlab)

    return fig