Visualization Module¶
gaico.visualize.plot_metric_comparison ¶
plot_metric_comparison(df, aggregate_func=None, **kwargs)
Generates a bar plot comparing different models based on a single metric, after aggregating scores using the provided aggregate_func.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
df
|
DataFrame
|
DataFrame containing the scores, typically from prepare_results_dataframe. Expected columns are defined by model_col, metric_col, and score_col in kwargs. |
required |
aggregate_func
|
Optional[Callable]
|
A function to aggregate scores (e.g., numpy.mean, numpy.median). Defaults to numpy.mean if None. |
None
|
kwargs
|
Any
|
Additional keyword arguments: - metric_name (str, required): The name of the metric to plot. - model_col (str, optional): Name of the column identifying models. Defaults to "model_name". - score_col (str, optional): Name of the column containing scores. Defaults to "score". - metric_col (str, optional): Name of the column containing metric names. Defaults to "metric_name". - title (Optional[str], optional): Title for the plot. - xlabel (Optional[str], optional): Label for the x-axis. Defaults to "Model". - ylabel (Optional[str], optional): Label for the y-axis. Defaults to the plotted metric's name. - figsize (tuple, optional): Figure size. Defaults to (10, 6). - axis (Optional[matplotlib.axes.Axes], optional): Matplotlib Axes to plot on. - Other kwargs are passed to seaborn.barplot. |
{}
|
Returns:
Type | Description |
---|---|
matplotlib.axes.Axes
|
The matplotlib Axes object containing the plot. |
Raises:
Type | Description |
---|---|
ImportError
|
If required libraries (matplotlib, seaborn, pandas, numpy) are not installed. |
ValueError
|
If 'metric_name' is not provided in kwargs. |
gaico.visualize.plot_radar_comparison ¶
plot_radar_comparison(df, aggregate_func=None, **kwargs)
Generates a radar plot comparing multiple models across several metrics, after aggregating scores using the provided aggregate_func.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
df
|
DataFrame
|
DataFrame containing the scores in long format, typically from prepare_results_dataframe. Expected columns are defined by model_col, metric_col, and score_col in kwargs. |
required |
aggregate_func
|
Optional[Callable]
|
A function to aggregate scores (e.g., numpy.mean, numpy.median). Defaults to numpy.mean if None. |
None
|
kwargs
|
Any
|
Additional keyword arguments: - metrics (List[str], optional): List of metric names to include. If None, all metrics in df are used. - model_col (str, optional): Name of the column identifying models. Defaults to "model_name". - score_col (str, optional): Name of the column containing scores. Defaults to "score". - metric_col (str, optional): Name of the column containing metric names. Defaults to "metric_name". - title (Optional[str], optional): Title for the plot. Defaults to "Model Comparison Radar Plot". - figsize (tuple, optional): Figure size. Defaults to (8, 8). - fill_alpha (float, optional): Alpha for filled area. Defaults to 0.1. - line_width (float, optional): Width of plot lines. Defaults to 1.0. - y_ticks (Optional[List[float]], optional): Custom y-axis ticks. - axis (Optional[matplotlib.axes.Axes], optional): Matplotlib polar Axes to plot on. |
{}
|
Returns:
Type | Description |
---|---|
matplotlib.axes.Axes
|
The matplotlib Axes object containing the plot. |
Raises:
Type | Description |
---|---|
ImportError
|
If required libraries (matplotlib, numpy, pandas) are not installed. |
ValueError
|
If aggregation results in no data or metrics. |