{
  "slug": "covariate-shift",
  "term": "Covariate shift",
  "aliases": [
    "input distribution shift"
  ],
  "definition": "Covariate shift is a change in the distribution of input features while the conditional distribution of the outcome given those features stays unchanged.",
  "note": "For source P and target Q, covariate shift assumes P(Y | X) = Q(Y | X), while P(X) and Q(X) differ. Class prevalence can change too. This differs from label shift, which holds P(X | Y) fixed. [sugiyama-jmlr07] [lipton-icml18]\n\nFor a fixed predictor and integrable loss, target expected loss equals the source expectation of w(X) times loss, with w(x) = Q(x)/P(x), provided target feature support is covered by source support. A source-only average without these weights generally evaluates a different population. [sugiyama-jmlr07]\n\nIn a constructed two-stratum population, event probabilities stay 1/10 in A and 4/5 in B; the same rule alerts only on B. Changing the A:B mixture from 1:1 to 9:1 changes recall from 8/9 to 8/17 and false-positive rate from 2/11 to 2/83. Weights 9/5 for A and 1/5 for B recover the target confusion probabilities exactly. These are synthetic population probabilities, not observed disk counts. [worked-example]\n\nA change in device mix alone does not establish unchanged conditional failure risk. Keep features, event definition, horizon and prediction rule explicit. [lipton-icml18]\n\nAn exact iid sampling control draws two observations with replacement from that constructed source population. The expected weighted true-positive mean is 2/25 and the expected weighted positive mean is 17/100, whose ratio is the target recall 8/17. But expected sample weighted recall, conditional on a nonzero denominator, is 1208/1395. A zero-positive sample occurs with probability 121/400 and has undefined recall, not zero recall. The control enumerates all 16 ordered outcome sequences; it is not an observed sample or a general bias bound. [finite-sample]",
  "limitations": [
    {
      "text": "No source reweighting can recover outcomes in a feature region with positive target probability but zero source probability.",
      "citationIds": [
        "sugiyama-jmlr07"
      ]
    },
    {
      "text": "Large or estimated weights can make finite-sample estimates unstable; the population identity does not guarantee unbiased finite-sample recall ratios or validate the unchanged-conditional assumption.",
      "citationIds": [
        "sugiyama-jmlr07"
      ]
    }
  ],
  "related": [
    "label-shift"
  ],
  "citations": [
    {
      "id": "sugiyama-jmlr07",
      "title": "Sugiyama, Krauledat and Mueller (2007). Covariate Shift Adaptation by Importance Weighted Cross Validation. JMLR 8:985-1005, sections 2.1-2.2 and 3, Lemma 1.",
      "url": "https://jmlr.org/papers/volume8/sugiyama07a/sugiyama07a.pdf",
      "accessed": "2026-11-23"
    },
    {
      "id": "lipton-icml18",
      "title": "Lipton, Wang and Smola (2018). Detecting and Correcting for Label Shift with Black Box Predictors. ICML, section 1: contrasting conditional assumptions.",
      "url": "https://proceedings.mlr.press/v80/lipton18a/lipton18a.pdf",
      "accessed": "2026-11-23"
    },
    {
      "id": "worked-example",
      "title": "Hesela: exact synthetic covariate-shift confusion probabilities and importance weights; CC0 replay and tests.",
      "url": "https://hesela.dev/research/covariate-shift/results.json",
      "accessed": "2026-11-23"
    },
    {
      "id": "cloud-reading",
      "title": "Hesela: cloud disk-error prediction and why feature-mixture changes do not establish rate transfer.",
      "url": "https://hesela.com/analyses/cloud-disk-error-prediction/#covariate-shift-heading",
      "accessed": "2026-11-23"
    },
    {
      "id": "finite-sample",
      "title": "Hesela: exact enumeration showing a ratio of unbiased weighted means need not be unbiased; two iid draws from the synthetic example.",
      "url": "https://hesela.dev/research/covariate-shift/finite-sample.json",
      "accessed": "2026-11-23"
    }
  ],
  "status": "unknown",
  "advantages": [],
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "updated": "2026-11-23",
  "provenance": [
    "2026-11-23: read Sugiyama et al. sections 2.1-2.2 and 3 for the invariant outcome conditional, finite known density-ratio assumption, risk identity and finite-sample variance limits.",
    "2026-11-23: read Lipton et al. section 1 to distinguish covariate from label shift. Device-mix and horizon cautions are storage-specific applications of those assumptions, not findings about Azure.",
    "The two-stratum example is exact rational arithmetic independently checked by a separate read-only agent. It is not sampled data, a paper replication, a fleet estimate or an empirical uncertainty interval.",
    "2026-11-23: added an original finite-sample ratio control, checking 16 ordered sequences against an independent closed-form calculation. Zero denominators are reported explicitly; no empirical uncertainty or hardware conclusion is claimed."
  ]
}
