reporting
orchard.evaluation.reporting
¶
Reporting & Experiment Summarization Module.
This module orchestrates the generation of human-readable artifacts following the completion of a training pipeline. It leverages Pydantic for strict validation of experiment results and transforms raw metrics into structured, professionally formatted Excel summaries.
TrainingReport
¶
Bases: BaseModel
Validated data container for summarizing a complete training experiment.
This model serves as a Schema for the final experimental metadata. It stores hardware, hyperparameter, and performance states to ensure full reproducibility and traceability of the training pipeline.
Attributes:
| Name | Type | Description |
|---|---|---|
timestamp |
str
|
ISO formatted execution time. |
architecture |
str
|
Identifier of the architecture used. |
dataset |
str
|
Name of the dataset. |
best_val_accuracy |
float
|
Peak accuracy achieved on validation set. |
best_val_auc |
float
|
Peak ROC-AUC achieved on validation set. |
best_val_f1 |
float
|
Peak macro-averaged F1 on validation set. |
test_accuracy |
float
|
Final accuracy on the unseen test set. |
test_auc |
float
|
Final ROC-AUC on the unseen test set. |
test_macro_f1 |
float
|
Macro-averaged F1 score (key for imbalanced data). |
is_texture_based |
bool
|
Whether texture-preserving logic was applied. |
is_anatomical |
bool
|
Whether anatomical orientation constraints were enforced. |
use_tta |
bool
|
Indicates if Test-Time Augmentation was active. |
epochs_trained |
int
|
Total number of optimization cycles completed. |
learning_rate |
float
|
Initial learning rate used by the optimizer. |
batch_size |
int
|
Samples processed per iteration. |
seed |
int
|
Global RNG seed for experiment replication. |
augmentations |
str
|
Descriptive string of the transformation pipeline. |
normalization |
str
|
Mean/Std statistics applied to the input tensors. |
model_path |
str
|
Absolute path to the best saved checkpoint. |
log_path |
str
|
Absolute path to the session execution log. |
to_vertical_df()
¶
Converts the Pydantic model into a vertical pandas DataFrame.
Returns:
| Type | Description |
|---|---|
DataFrame
|
pd.DataFrame: A two-column DataFrame (Parameter, Value) for Excel export. |
Source code in orchard/evaluation/reporting.py
save(path, fmt='xlsx')
¶
Saves the report to disk in the requested format.
Supported formats
xlsx: Professional Excel with conditional formatting.csv: Flat CSV (two columns: Parameter, Value).json: Pretty-printed JSON array.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path
|
Base file path (suffix is replaced to match fmt). |
required |
fmt
|
str
|
Output format — one of |
'xlsx'
|
Source code in orchard/evaluation/reporting.py
create_structured_report(val_metrics, test_metrics, macro_f1, train_losses, best_path, log_path, arch_name, dataset, training, aug_info=None)
¶
Constructs a TrainingReport object using final metrics and configuration.
This factory method aggregates disparate pipeline results into a single validated container, resolving paths and extracting augmentation summaries.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
val_metrics
|
Sequence[Mapping[str, float]]
|
History of per-epoch validation metric dicts. |
required |
test_metrics
|
dict[str, float]
|
Final test-set metric dict (accuracy, auc, etc.). |
required |
macro_f1
|
float
|
Final Macro F1 score on test set. |
required |
train_losses
|
Sequence[float]
|
History of per-epoch training losses. |
required |
best_path
|
Path
|
Path to the saved model weights. |
required |
log_path
|
Path
|
Path to the run log file. |
required |
arch_name
|
str
|
Architecture identifier (e.g. |
required |
dataset
|
DatasetConfig
|
Dataset sub-config with metadata, name, and normalization info. |
required |
training
|
TrainingConfig
|
Training sub-config with hyperparameters and flags. |
required |
aug_info
|
str | None
|
Pre-formatted augmentation string. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
TrainingReport |
TrainingReport
|
A validated Pydantic model ready for export. |