nirs4all.visualization.reports module

Tab Report Manager - Simplified tab report generation with formatting and saving

This module provides a clean interface for generating standardized tab-based CSV reports using pre-calculated metrics and statistics from the evaluator module.

class nirs4all.visualization.reports.TabReportManager[source]

Bases: object

Generate standardized tab-based CSV reports with pre-calculated data.

static generate_best_score_tab_report(best_by_partition: Dict[str, Dict[str, Any]], aggregate: str | bool | None = None, aggregate_method: str | None = None, aggregate_exclude_outliers: bool = False) Tuple[str, str | None][source]

Generate best score tab report from partition data.

Parameters:
  • best_by_partition – Dict mapping partition names (‘train’, ‘val’, ‘test’) to prediction entries

  • aggregate – Sample aggregation setting for computing additional aggregated metrics. - None (default): No aggregation, only raw scores displayed - True: Aggregate by y_true values (group by target) - str: Aggregate by specified metadata column (e.g., ‘sample_id’, ‘ID’) When set, both raw and aggregated scores are included in the output. Aggregated rows are marked with an asterisk (*).

  • aggregate_method – Aggregation method for combining predictions. - None (default): Use ‘mean’ for regression, ‘vote’ for classification - ‘mean’: Average predictions within each group - ‘median’: Median prediction within each group - ‘vote’: Majority voting (for classification)

  • aggregate_exclude_outliers – If True, exclude outliers using T² statistic before aggregation (default: False).

Returns:

Tuple of (formatted_string, csv_string_content) If aggregate is set, both raw and aggregated scores are included.