📈 GH Trending Explorer 🎲 Surprise me

← all repos

weikaixi / CrossDomainAdjust

git clone https://github.com/weikaixi/CrossDomainAdjust.git v2.1.0 · 28d ago

R package for frozen rank and pair encoding, partial domain centering and projection, fold-local lambda tuning, and reproducible cross-domain workflows.

+0
stars, 24h · #37,111
+~-19
stars, 7 days · #61,992
+72
stars, 30 days · #9,110
72
★ total · -19% this week
2
forks · 0 open issues

Star history (as recorded here)

2026-10-20 · 80 ★ 2026-10-23 · 72 ★
LanguageR
License—
Created2026-09-25 (28d ago)
Last push18d ago
Watchers7
OwnerUser

Links

README excerpt
# CrossDomainAdjust
**Reusable feature encoding and partial cross-domain adjustment in R — version 2.1.0.**
中文说明 · Detailed user guide ·
中文完整手册 · 15 runnable examples ·
Data provenance · Release validation
CrossDomainAdjust learns preprocessing on training samples and applies the same frozen
transformation to a new cohort or an individual sample. It provides four convenient
methods for cross-domain modeling, plus a lower-level composable API. It does not assume
that domain differences are entirely technical: cancer type and genetic background can
contribute both to expression differences and to prognosis.
| Method | `method` | Transformation | Feature scaling | Target domain label |
|---|---|---|---|---|
| Within-sample rank | `"rank"` | Fractional ranks over a fixed gene universe | Frozen training z-score | Not needed |
| Binary gene pairs | `"pair"` | `I(gene_i > gene_j)`; retain training prevalence 20–80% | Frozen training z-score | Not needed |
| Partial center translation | `"center"` | Subtract a fraction of a fitted domain offset | None | Known training domain required at nonzero λ |
| Partial domain projection | `"project"` | Remove a fraction of a learned low-rank direction | None | Not needed |
Raw input is assumed to have already received appropriate assay-level processing. These
functions do not turn raw sequencing counts into normalized expression. Centering and
projection use the supplied scale, without adding a gene-wise z-score in the presets.
## Installation
R >= 4.1.0. Core code uses only R's `stats` and `utils`; no compiled code or Rtools is
needed for this package. Survival examples use the recommended package `survival`.
 [code] 
For an archived source tarball:
 [code] 
## A complete first example
 [code] 
Replace `method = "project"` with `"rank"`, `"pair"` or `"center"`. For center translation,
also pass the corresponding labels to `transform_cross_domain(prep, test$x, test$domain)`.
For pair encoding, `frequency = c(0.2, 0.8)` and `max_pairs = 128` control feature growth.
## Choosing λ
`tune_cross_domain()` fits preprocessing independently inside every training fold.
The default grid is **0, 0.2, 0.4, 0.6, 0.8, 1**. Supply model-fitting, prediction and
scoring callbacks; higher scores are better. Vector, matrix, data-frame and `Surv`
outcomes are supported. See the complete regression
and survival examples.
 [code] 
This diagnostic uses a PCA basis fixed at λ = 0, and full-feature between-domain /
total variation. It describes geometry; it does **not** choose a prognostically optimal
λ. At λ = 1, mean-based full-rank adjustment can align the fitting-domain centroids.
It does not generally make distributions identical or preserve all useful biology.
An interior optimum is possible, not imposed. Keep the complete grid and all seeds.
## Examples included with the installed package
| No. | Scenario | Main lesson |
|---|---|---|
| 01 | Four methods | One interface, distinct represent