diff_binom_confint.make_risk_report#

diff_binom_confint.make_risk_report(data_source: DataFrame | Tuple[DataFrame, DataFrame], target: str, positive_class: str | int | float | None = None, ref_classes: Sequence[Dict[str, str]] | None = None, risk_name: str | None = None, conf_level: float = 0.95, method: str = 'wilson', diff_method: str = 'wilson', dropna: bool = True, save_path: Path | str | None = None, return_type: str = 'pd', **kwargs) DataFrame | dict | str[source]#

Make risk report for binomial confidence interval.

Parameters:
  • data_source (pandas.DataFrame or tuple of two pandas.DataFrame) – Data source table. Each column should be categorical (including binary). Numerical columns should be discretized by the users themselves before passing to this function. If is a tuple of two DataFrame s, the two tables are train/validation tables, respectively.

  • target (str) – Target column name.

  • positive_class (str, int or float) – Positive class. If is None, non-null value (making if statement True) will be considered as positive class.

  • ref_classes (list, optional) – Reference classes (for difference computation). If is None, reference classes will be chosen as the largest classes for each column.

  • risk_name (str, optional) – Risk name. If is None, the risk name will be given by the positive class name and the target column name.

  • conf_level (float, default 0.95) – Confidence level, should be inside the interval (0, 1).

  • method (str, default "wilson") – Type (computation method) of the confidence interval. For a full list of the available methods, see diff_binom_confint.list_confidence_interval_methods().

  • diff_method (str, default "wilson") – Type (computation method) of the confidence interval of the difference. For a full list of the available methods, see diff_binom_confint.list_difference_confidence_interval_methods().

  • dropna (bool, default True) – Whether to drop missing values (column-wise). A better way is that the users deal with missing values themselves.

  • save_path (str or pathlib.Path, optional) – Path to save the report table. If is None, the report table will not be saved.

  • return_type ({"pd", "dict", "latex", "md", "markdown", "html"}, default "pd") – The type of the returned report table. - “pd”: pandas.DataFrame - “dict”: dict - “latex”: LaTeX table - “md” or “markdown”: Markdown table - “html”: HTML table

  • **kwargs (dict, optional) – Other parameters passed to diff_binom_confint.compute_confidence_interval() and diff_binom_confint.compute_difference_confidence_interval().

Returns:

Report table.

Return type:

Union[pandas.DataFrame, dict, str]