nirs4all.visualization.charts.candlestick module
CandlestickChart - Candlestick/box plot for score distributions by variable.
- class nirs4all.visualization.charts.candlestick.CandlestickChart(predictions, dataset_name_override: str | None = None, config=None, analyzer: PredictionAnalyzer | None = None)[source]
Bases:
BaseChartCandlestick/box plot for score distributions by variable.
Shows score distribution statistics (min, Q25, mean, Q75, max) for each value of a grouping variable.
- render(variable: str, display_metric: str | None = None, display_partition: str = 'test', dataset_name: str | None = None, figsize: tuple | None = None, aggregate: bool | str | None = None, aggregate_method: str | None = None, aggregate_exclude_outliers: bool | None = None, clip_outliers: bool = True, iqr_factor: float = 1.5, task_type: str | None = None, score_scope: str = 'refit', **filters) Figure | list[Figure][source]
Render candlestick chart showing metric distribution by variable (Optimized with Polars).
- Parameters:
variable – Variable to group by (e.g., ‘model_name’, ‘preprocessings’).
display_metric – Metric to analyze (default: auto-detect from task type).
display_partition – Partition to display scores from (default: ‘test’).
dataset_name – Optional dataset filter.
figsize – Figure size tuple (default: from config).
aggregate – Aggregation mode for the chart.
aggregate_method – Aggregation method (
"mean","median", or"vote").aggregate_exclude_outliers – Whether grouped aggregation excludes outliers before reducing each group.
clip_outliers – If True, constrain the y-axis to show the main distribution and let extreme outliers go off-frame (default: True).
iqr_factor – Factor to multiply IQR for determining outlier bounds. Higher values show more of the tails (default: 1.5).
task_type – If provided, filter predictions to this task type. When None and mixed task types exist, renders separate figures per task type.
**filters – Additional filters (config_name, etc.).
- Returns:
matplotlib Figure object, or a list of Figures when auto-separating by task type.
- validate_inputs(variable: str, display_metric: str | None, **kwargs) None[source]
Validate candlestick inputs.
- Parameters:
variable – Variable name to group by.
display_metric – Metric name to analyze.
**kwargs – Additional parameters (ignored).
- Raises:
ValueError – If variable or display_metric is invalid.