Skip to content
mlmentorship

Domain adaptation

Transfer a model across related but shifted data distributions without assuming unlabeled target data makes the problem identifiable.

Published · 7 min read ·Specialist ·Intermediate
Reading depth

Summary

Domain adaptation transfers a predictor between source and target populations under explicit assumptions about what changed. Specify the shared label space, sampling unit, available target supervision, time period, and deployment slices. Unlabeled target inputs can reveal an input mixture without identifying a changed labeling rule.

Our teaching fixture has two input bins, fixed predictor errors , and different population mixtures. Compute target risk before choosing a correction.

Shift types

  • Covariate shift: changes while is stable.
  • Label shift: changes while is stable.
  • Concept shift: changes; unlabeled target data alone is generally not enough.

Multiple factors can move together; a drift test on inputs does not establish an unchanged conditional distribution.

The same input distribution can hide a different label rule

Matching inputs can hide a reversed label ruleBoth domains can show x=0 and x=1 equally often. Their opposite labels make this concept shift, not merely covariate shift.The inputs match; their label rulesreverseDomain A: two zeros, two ones0y=00y=01y=11y=1Domain B: two zeros, two ones0y=10y=11y=01y=0Equal input frequencies cannot revealthis label shift.
Derivation
Which factor moved? Inspect the same joint-probability cellsToy joint tables change only the declared factor. Covariate shift moves P(X=1) from .2 to .8 with fixed label conditionals. Label shift moves P(Y=1) from .2 to .8 with fixed input conditionals. Two concept-shift worlds then share identical balanced inputs but opposite deterministic label rules.Toy joint probabilities P(X, Y); each panel sumsto 1COVARIATE: only P(X) changesSOURCEY=0Y=10.720.080.020.18TARGETY=0Y=10.180.020.080.72X=0X=1P(Y=1 | X=0)=.1; P(Y=1 | X=1)=.9P(X=1): .2 -> .8; support overlapsLABEL: only P(Y) changesSOURCEY=0Y=10.600.050.200.15TARGETY=0Y=10.150.200.050.60X=0X=1P(X=1 | Y=0)=.25; P(X=1 | Y=1)=.75P(Y=1): .2 -> .8; identifiable statistic neededCONCEPT: same target inputs, incompatiblelabelsBoth worlds: P(X=0)=P(X=1)=0.5World AY = XWorld BY = 1 - XUnlabeled X cannot distinguish theseworlds.
Rows index X and columns index Y. Check the stated conditional against the cells. Identical target input marginals cannot identify which opposite label rule holds.
Check: How can two targets have identical observed X distributions but require different predictions?
Read it this way: Both domains can show x=0 and x=1 equally often. Their opposite labels make this concept shift, not merely covariate shift.
Can a method checking only the input counts detect this reversed rule?

Work the target risk

Input binSource massTarget massConditional errorTarget/source weight
00.80.20.10.25
10.20.80.44

Source risk is . Target risk is . Under stable and target support contained in source support,

The weighted source calculation gives . This verifies the algebra, not the real-world invariance assumption. For 80/20 source rows, the weight-based effective sample size is

Large weights can reduce precision; clipping them changes the estimate and can introduce bias.

Receive target labels

New task: use a small representative labeled target sample to test the assumed relationship.

Picture and change: reserve separate target evaluation; use adaptation labels for calibration or fitting, not both fitting and final scoring.

Check: target conditional error rates would instead give risk . Input reweighting alone still returns , so it cannot repair that changed error relationship. Allow sampling uncertainty before concluding that a finite sample establishes concept drift.

Use when: labeled evidence can discriminate assumptions that target inputs alone cannot test.

Lose support or the labeling invariant

New task: deploy where the source has no observations or the target label rule differs.

Picture and change: restrict claims, collect justified labels, or abstain rather than inventing density ratios.

Check: if source mass on bin 1 is zero, its target mass has no source-label support. With error in bin 0 and bounded loss, target risk can range from to . Separately, uniform inputs can accompany either or . Predictor then has risk zero or one despite identical input distributions.

Use when: overlap or conditional invariance fails; matching feature distributions is not proof of transfer.

Approaches

  • Importance weighting requires the named invariant and support.
  • Target fine-tuning requires representative supervision and separate evaluation.
  • Feature alignment requires preserving label-relevant distinctions.
  • Self-training can reinforce confident mistakes; validate its assumptions and calibration.
  • Domain-specific normalization or adapters change the fitted model, not identifiability by themselves.
  • Robust objectives compare the environments actually observed, not every possible future shift.

Under label shift, a fixed classifier statistic can satisfy . Columns of are its stable prediction distributions given each class; contains target class priors. For binary true-positive/false-positive rates and target positive-prediction rate , the target prior is

If the two conditional rates coincide, this statistic cannot identify that prior.

Evaluation

Compare source-only and target-supervised baselines on a true target holdout. Report target slices, calibration, source retention, uncertainty, and negative transfer. Reusing target evaluation labels for adaptation requires a new evaluation split.

In an interview

Can unlabeled target inputs distinguish the two opposite label rules above?

Answer

No. Their input likelihoods agree exactly. Target labels or additional structural assumptions are necessary.

Common confusions

Aligned features or lower adaptation loss do not establish preserved class structure. Biased target labels can worsen transfer even when their training loss decreases.

Related: cross-validation strategies, epistemic versus aleatoric uncertainty, and calibration.