scdecon.validation¶
validation ¶
Validation: accuracy metrics for deconvolution against known proportions.
A pure computation layer (NumPy / pandas / scipy.stats) operating on
proportion DataFrame objects oriented as cell types x samples. It imports no
I/O or plotting.
ValidationReport
dataclass
¶
Typed, lightweight result of a validation run.
Attributes:
| Name | Type | Description |
|---|---|---|
overall_rmse |
float
|
Root-mean-square error across all cell-type x sample entries. |
per_type |
DataFrame
|
One row per cell type (index), with columns |
align_proportions ¶
Check that truth and prediction describe the same data and align them.
Both must be cell types (index) x samples (columns) with identical cell-type and sample label sets (order-independent). The prediction is reindexed to the truth's cell-type and sample order.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
truth
|
DataFrame
|
Ground-truth proportions (cell types x samples). |
required |
prediction
|
DataFrame
|
Estimated proportions (cell types x samples). |
required |
Returns:
| Type | Description |
|---|---|
tuple[DataFrame, DataFrame]
|
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If either frame is empty, has duplicate cell-type or sample labels, or the cell-type / sample label sets differ. |
evaluate ¶
Score estimated proportions against ground truth.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
truth
|
DataFrame
|
Ground-truth proportions, cell types (index) x samples (columns). |
required |
prediction
|
DataFrame
|
Estimated proportions, same orientation and labels as |
required |
Returns:
| Type | Description |
|---|---|
ValidationReport
|
Overall RMSE and per-cell-type RMSE / Pearson / Spearman. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the inputs cannot be aligned (see :func: |