Skip to content

Add weighted samples for TRF #17

Description

@Hugo-W

Description

Enable weighted samples for TRF estimation, allowing for confidence-based weighting (e.g., from EOG or muscle artifact data) or phase information.

Tasks

  • Implement support for weighted samples in TRF estimation.
  • Allow weighting based on confidence of samples (e.g., from EOG or muscle artifact sliding window data).
  • Support phase information as a weight matrix or to mask data points.
  • Implement robust TRF using a log-based error function (e.g., $d(e) = \log(1 + (e/\sigma)^2)$) instead of classic MSE.
  • Use iterative methods (e.g., conjugate gradient) for robust TRF estimation.

Mathematical Background

For weighted samples, the regression formulation is:
$$\min_{\vec{\beta}}||W(\vec{y} - X\vec{\beta})||^2$$
where $W$ is an $N \times N$ diagonal matrix with error weights on the diagonal. The solution is:
$$\vec{\beta}_{opt} = (X^TW^TWX)^{-1}X^TW^TW\vec{y}$$

Acceptance Criteria

  • TRFEstimator supports weighted samples via a weights parameter.
  • Robust TRF with log-based error function is available.
  • Iterative solvers (e.g., conjugate gradient) are used for robust TRF estimation.
  • Backward compatibility with existing TRFEstimator usage is maintained.

Priority

High

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions