Skip to content

Commit

Permalink
add logic to turn off/on the errors
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickleonardy committed Sep 1, 2023
1 parent 8688888 commit b56fb36
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions cobra/evaluation/pigs_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import cobra.utils as utils
import logging

logging.basicConfig(level=logging.DEBUG)
# logging.basicConfig(level=logging.DEBUG)


def generate_pig_tables(
Expand Down Expand Up @@ -118,7 +118,7 @@ def plot_incidence(
model_type: str,
column_order: list = None,
dim: tuple = (12, 8),
show_error=False,
show_error: bool = False,
):
"""Plots a Predictor Insights Graph (PIG), a graph in which the mean
target value is plotted for a number of bins constructed from a predictor
Expand All @@ -142,6 +142,9 @@ def plot_incidence(
on the PIG.
dim: tuple, default=(12, 8)
Optional tuple to configure the width and length of the plot.
show_error: bool, default=False
Indicate if the standard deviation per bin should be showed. This can
be useful in regression.
"""
if model_type not in ["classification", "regression"]:
raise ValueError(
Expand Down Expand Up @@ -174,11 +177,11 @@ def plot_incidence(
# --------------------------
# Left axis - average target
# --------------------------

error = df_plot["std_dev_target"] / 2 if show_error else None
ax.errorbar(
df_plot["label"],
df_plot["avg_target"],
yerr=df_plot["std_dev_target"] / 2,
yerr=error,
color="#00ccff",
marker=".",
markersize=15,
Expand Down

0 comments on commit b56fb36

Please sign in to comment.