---
title: Conditional Probability Shift Model
url: https://www.emergentmind.com/topics/conditional-probability-shift-model-cpsm
type: topic
---

# Conditional Probability Shift Model

The Conditional Probability Shift Model (CPSM) addresses a nuanced regime of distributional shift in supervised learning, generalizing beyond the classical covariate shift and label shift frameworks. In CPSM, the conditional distribution of the class label given a subset of features (“conditioning” features) is allowed to change from source to target, while the conditional distribution of the remaining features, given the class and conditioning features, remains invariant. CPSM provides a principled methodology for recovering the posterior class probabilities on the target domain, relying on parameterization via multinomial logistic regression and parameter estimation through the Expectation-Maximization (EM) algorithm in the presence of missing target labels [2503.02583].

## 1. Problem Definition and Conditional Probability Shift Assumption

Let $X \in \mathbb{R}^p$ denote the observed feature vector and $Y \in \{1, \ldots, K\}$ the class label. CPSM partitions $X = (Z, W)$, where $Z \in \mathbb{R}^d$ includes the “conditioning” features suspected of experiencing a shift in $P(Y|Z)$, and $W \in \mathbb{R}^{p-d}$ consists of all remaining features. The model presumes access to labeled samples from a source distribution $P_S(Z, W, Y)$ and only unlabeled samples from a target marginal $P_T(Z, W)$.

The central CPS assumption posits:
- $P_S(W|Z,Y) = P_T(W|Z,Y)$ (invariance of the “anti-causal” slice)
- $P_S(Y|Z) \neq P_T(Y|Z)$ (shift of the class-conditional on $Z$)

Joint distributions factor as:
\[
P_S(Z, W, Y) = P_S(Z)\,P_S(Y|Z)\,P_S(W|Z,Y)
\]
\[
P_T(Z, W, Y) = P_T(Z)\,P_T(Y|Z)\,P_S(W|Z,Y)
\]

Selecting $Z \equiv X$ recovers classic covariate shift ($P_S(Y|X) = P_T(Y|X)$, $P_S(X) \neq P_T(X)$). Setting $Z$ trivializes to label shift ($P_S(Y) \neq P_T(Y)$, $P_S(X|Y) = P_T(X|Y)$). CPSM thus interpolates between these domains, uniquely capturing situations where $P(Y|Z)$ varies while “downstream” structure remains stable.

## 2. Posterior Recovery and Model Parameterization

The inferential target is $P_T(Y \mid Z, W)$. By Bayes' rule and the invariance of $P(W|Z,Y)$, the target posterior is expressed as:
\[
P_T(Y=k \mid Z=z, W=w) = \frac{P_S(Y=k \mid Z=z, W=w)\ \omega_k(z)}{\sum_{\ell=1}^{K} P_S(Y=\ell \mid Z=z, W=w)\ \omega_\ell(z)}
\]
where $\omega_k(z) = P_T(Y=k \mid Z=z) / P_S(Y=k \mid Z=z)$ is the local “tilt” of the class-conditional.

This formulation reduces the adaptation task to that of learning the set of ratios $\omega_k(z)$.

CPSM parameterizes $P_T(Y|Z)$ as a multinomial logistic regression:
\[
P_T(Y=k|Z=z; \gamma) = \frac{\exp(\gamma_{k,0} + \gamma_k^T \phi(z))}{1 + \sum_{\ell=1}^{K-1} \exp(\gamma_{\ell,0} + \gamma_\ell^T \phi(z))}
\]
\[
P_T(Y=K|Z=z; \gamma) = \frac{1}{1 + \sum_{\ell=1}^{K-1} \exp(\gamma_{\ell,0} + \gamma_\ell^T \phi(z))}
\]
for $k = 1, \dots, K-1$ and some feature mapping $\phi(z) \in \mathbb{R}^m$. The true $P_T(Y|Z)$ is assumed to be in this family for some $\gamma^{*}$.

## 3. Expectation-Maximization Estimation

Since target labels are unobserved, parameter estimation proceeds by maximizing the observed target marginal likelihood using the EM algorithm.

**E-step:** At iteration $t$, compute the pseudo-responsibilities
\[
r_{ik}^{(t)} = P_T(Y=k \mid z_i, w_i; \gamma^{(t)}) = \frac{P_S(Y=k|z_i, w_i)\ \omega_k(z_i; \gamma^{(t)})}{\sum_{\ell} P_S(Y=\ell|z_i, w_i)\ \omega_\ell(z_i; \gamma^{(t)})}
\]
with $\omega_k(z; \gamma^{(t)}) = P_T(Y=k|z; \gamma^{(t)}) / P_S(Y=k|z)$.

**M-step:** Update $\gamma$ by maximizing
\[
Q(\gamma \mid \gamma^{(t)}) = \sum_{i=1}^{n_T} \sum_{k=1}^K r_{ik}^{(t)} \log P_T(Y=k|Z=z_i; \gamma)
\]
This coincides with the weighted multinomial logistic regression log-likelihood, solvable by Newton–Raphson or stochastic gradient methods. The procedure is initialized at $\gamma^{(0)} = 0$ (no shift).

Standard EM theory ensures that the observed likelihood is non-decreasing. Under regularity conditions, the procedure converges to a stationary point of the likelihood.

## 4. Integration with Probabilistic Classifiers

CPSM requires, from labeled source data:
- $P_S(Y=k|Z=z, W=w)$ (“posterior model”)
- $P_S(Y=k|Z=z)$ (“marginal model”)

These posteriors can be estimated using any probabilistic classifier (e.g., logistic regression, random forest, neural network) trained on source data. Typically:
- A classifier predicts $Y$ from $(Z, W)$ to provide $\hat{P}_S(Y|z, w)$.
- A separate classifier predicts $Y$ from $Z$ only to estimate $\hat{P}_S(Y|z)$.

These models supply the necessary terms for the E-step. Upon convergence of EM and estimation of $\hat{\gamma}$, the target posterior $P_T(Y|Z=z, W=w)$ is reconstructed via the closed-form correction formula provided above.

## 5. Special Cases and Identifiability

- If $\phi(z)$ is constant, $P_T(Y|Z)$ reduces to $P_T(Y)$, and CPSM collapses to the classical label shift model, with $\gamma_k$ modeling the class priors.
- If $\gamma = 0$ (i.e., $\omega_k(z) \equiv 1$), $P_T(Y|Z) = P_S(Y|Z)$, yielding the covariate shift regime with unchanged posterior mapping.
- Identifiability of $\gamma$ is ensured provided the feature transformation $\phi(z)$ spans $\mathbb{R}^m$ and classes are not perfectly separated. Under these mild assumptions, the EM estimator is consistent as $n_T \to \infty$.

## 6. Empirical Evaluation

### Synthetic Studies

Two generative settings for $Z$ were examined: binary vectors and multivariate Gaussians. $Y \in \{0,1\}$ with $P_S(Y=1|Z)$ constant and $P_T(Y=1|Z)$ parameterized as a logistic function of $Z$. By modulating parameters, the following regimes were generated: no shift, label shift, CPS only, and joint shift. Additional features $W$ were sampled conditionally according to the invariant $P_S(W|Z,Y)$.

Metrics included balanced accuracy and the absolute error $|\hat{Y}_T - Y_{\text{true}}|$. CPSM matched classical label shift methods (BBSC, MLLS) under pure label shift, but outperformed all methods—especially Sparse-Joint-Shift (SEES)—in all settings featuring conditional shifts ($P_T(Y|Z) \neq P_S(Y|Z)$ but no marginal label shift).

### MIMIC Medical Case Study

On the MIMIC medical database, the tasks involved predicting four disease indicators from laboratory/vital data, with $Z$ chosen as age category or gender. Source data was sampled to maintain constant $P_S(Y|Z)$; the target was perturbed to induce a conditional shift $P_T(Y|Z=1) = P_S(Y) + k$ for $k \in \{0.3, 0.5, 0.7\}$. Marginal label distributions could remain unchanged or shift.

Logistic regression and three-layer neural networks were used as base classifiers. Competing approaches encompassed NAIVE (no correction), BBSC and MLLS (label shift correction), ExTRA (exponential tilt for joint shift), and SEES. Results established that:
- In pure conditional shift (no label shift): NAIVE, BBSC, and MLLS did not improve target performance.
- CPSM consistently improved balanced accuracy by 10–20 points and minimized approximation error in nearly all settings.
- CPSM outperformed SEES (the only other SJS-based method) in terms of approximation error and balanced accuracy.

## 7. Context, Extensions, and Implications

CPSM provides a middle ground between covariate and label shift adaptations, rigorously addressing shifts that are localized in conditional class distributions yet cannot be ascribed solely to priors or marginal features. Its generic EM-based implementation and compatibility with arbitrary probabilistic classifiers make it broadly applicable in machine learning pipelines facing distributional changes that violate stronger shift assumptions. Empirical evidence suggests distinct advantages over prior label shift and joint shift correction methods in settings where conditional structure dominates and prior-based corrections are insufficient. A plausible implication is increased robustness to “hidden stratification” in clinical or high-dimensional scientific datasets, where subpopulation-specific prevalence can change without altering aggregate class proportions [2503.02583].

Source: https://www.emergentmind.com/topics/conditional-probability-shift-model-cpsm