Skip to contents

Used by add_interactions_progressive() between passes. Relearns the trajectory model twice — once with each end of atac_scores as the response — and returns a data frame with three engineered columns suitable for cbind() onto @additional_features:

Usage

default_score_split_features(traj_model, atac_scores, bin_start, bin_end)

Arguments

traj_model

A TrajectoryModel already fit with a first pass of interactions (so the relearns have something meaningful to fit).

atac_scores

A data frame / matrix of per-peak ATAC scores with one column per bin, rows aligned with traj_model@peak_intervals.

bin_start, bin_end

Column index (integer) or name (character) of the start and end bins in atac_scores.

Value

A data frame with columns base_pred, end_pred, pred_diff_e_b, row-aligned with traj_model@peak_intervals.

Details

  • base_pred: prediction under the bin_start score, scaled to [0, 10].

  • end_pred: prediction under the bin_end score, scaled to [0, 10].

  • pred_diff_e_b: end_pred - base_pred scaled to [0, 10].

These features mirror the manual pattern in Akhiad's analysis workflow and are what the second pass of add_interactions_progressive() anchors interactions against.

Requires atac_scores with at least two distinct columns. If the inputs don't support it, the caller should fall back to a single add_interactions() call.

Caveat — test-time leakage

Using this function as the additional_features_builder of add_interactions_progressive() injects base_pred / end_pred / pred_diff_e_b columns that are defined only for the training peaks the traj_model was fit on. If you later call infer_trajectory_motifs() on test peaks, those columns are imputed to 0 for the test rows, which drops test R^2 severely (measured: −0.27 on the gastrulation vignette). To use this builder correctly you must independently run the base-only / end-only helper models on the test peaks and supply the resulting predictions as additional_features at infer_trajectory_motifs() time.

Because this pitfall is easy to hit, iq_regression(strategy = "progressive") errors at call time — it reserves the progressive path for a future release that threads the test-time propagation through automatically. Use this builder only when calling add_interactions_progressive() directly with full control over test-time inference.