Skip to contents

Computes various types of reconstruction errors based on a fitted HATSA model. This helps quantify alignment quality, sanity check model components, or assess how well non-anchor information is captured.

Usage

reconstruction_error(object, type = "anchors", ...)

# S3 method for class 'hatsa_projector'
reconstruction_error(object, type = "anchors", ...)

Arguments

object

A fitted hatsa_projector object.

type

A character string specifying the type of reconstruction error to compute. One of:

  • "anchors" (Default): Error between subject-specific aligned anchor sketches and the group anchor template (`T_anchor_final`).

  • "all_parcels": Error between original subject sketches (`U_original_list`) and sketches reconstructed from aligned versions via inverse rotation. (Sanity check, should be near zero if rotations are orthogonal).

  • "non_anchors": Error in predicting non-anchor parcel sketches from anchor parcel sketches in the aligned space (Anchor Residual `ε̄`).

...

Additional arguments, potentially passed to internal helper functions (e.g., for non-anchor prediction methods).

Value

A named list containing reconstruction error metrics. The structure depends on the `type` requested, typically including `mean_error` and `per_subject_error`. For `type="non_anchors"`, it also includes `per_parcel_error`.

Examples

# Assuming `fit_obj` is a hatsa_projector from `run_hatsa_core()`
# Anchor reconstruction error
# reconstruction_error(fit_obj, type = "anchors")
# Sanity check using all parcels
# reconstruction_error(fit_obj, type = "all_parcels")
# Predict non-anchor parcels from anchors
# reconstruction_error(fit_obj, type = "non_anchors")