Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 27 additions & 14 deletions src/rtichoke/calibration/calibration.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,34 @@ def create_calibration_curve(
"#585123",
],
) -> Figure:
"""Creates Calibration Curve

Args:
probs (Dict[str, List[float]]): _description_
reals (Dict[str, List[int]]): _description_
calibration_type (str, optional): _description_. Defaults to "discrete".
size (Optional[int], optional): _description_. Defaults to None.
color_values (List[str], optional): _description_. Defaults to None.
url_api (_type_, optional): _description_. Defaults to "http://localhost:4242/".

Returns:
Figure: _description_
"""Creates a Calibration Curve.

This function generates a calibration curve, which evaluates how well
the predicted probabilities from one or more models align with the
observed binary outcomes. It can plot either discrete binned calibration
(deciles) or a smoothed calibration curve.

Parameters
----------
probs : Dict[str, np.ndarray]
A dictionary mapping model or dataset names to 1-D numpy arrays of
predicted probabilities.
reals : Union[np.ndarray, Dict[str, np.ndarray]]
The true binary labels (0 or 1). Can be a single array or a dictionary
mapping names to label arrays.
calibration_type : str, optional
The type of calibration curve to plot. Options are ``"discrete"`` (binned)
or ``"smooth"`` (smoothed lowess). Defaults to ``"discrete"``.
size : int, optional
The width and height of the plot in pixels. Defaults to 600.
color_values : List[str], optional
A list of hex color strings for the plot lines/markers.

Returns
-------
Figure
A Plotly ``Figure`` object representing the calibration curve.
"""
pass

calibration_curve_list = _create_calibration_curve_list(
probs, reals, size=size, color_values=color_values
)
Expand Down
15 changes: 10 additions & 5 deletions src/rtichoke/summary_report/summary_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,17 @@


def create_summary_report(probs, reals, url_api="http://localhost:4242/"):
"""Create rtichoke Summary Report
"""Creates a summary report for rtichoke model performance.

Args:
probs (_type_): _description_
reals (_type_): _description_
url_api (str, optional): _description_. Defaults to "http://localhost:4242/".
Parameters
----------
probs : Dict[str, np.ndarray]
A dictionary mapping model names to predicted probabilities.
reals : Union[np.ndarray, Dict[str, np.ndarray]]
The true outcome labels (0 or 1).
url_api : str, optional
The API endpoint URL of the R rtichoke backend.
Defaults to ``"http://localhost:4242/"``.
"""
rtichoke_response = send_requests_to_rtichoke_r(
dictionary_to_send={"probs": probs, "reals": reals},
Expand Down
Loading
Loading