Semi-supervised Logistic Regression

Machine Learning
Introduced by
Nigam, K.; McCallum, A. et al. (EM variant); Yarowsky, D. (self-training)
Year
1995–2000
Type
Semi-supervised classifier
Family
Machine learning

What does it do?

Semi-supervised logistic regression extends the standard logistic classifier by using unlabeled data during training.

Self-training and EM-based wrappers repeatedly assign tentative labels to unlabeled examples and refit the model's parameters, which can help when labeled data are scarce relative to the full dataset.

The intuition behind the method

Imagine training a disease classifier with only 50 confirmed diagnoses but 5,000 patient records whose outcome is unknown. Standard logistic regression ignores the unlabeled records. Semi-supervised logistic regression uses the model's own probabilistic predictions to assign tentative labels to the unlabeled cases, retrains on the enlarged set, and repeats. If the classes form groups that the unlabeled data help reveal, each iteration can move the decision boundary toward regions of higher data density, without requiring additional expert annotation. If the assumed structure does not hold, the same loop can reinforce the model's early mistakes.

History

Nigam, McCallum, Thrun and Mitchell (2000) applied expectation-maximization to text classification with unlabeled documents. The classifier in that paper is naive Bayes, so the logistic-regression variant described on this page should not be attributed to that source. Chapelle, Scholkopf and Zien (2006) edited an MIT Press volume that gives a broader overview of semi-supervised learning. Semi-supervised logistic regression is used in settings where labeled data are costly. Self-training versions are available through wrappers such as scikit-learn's SelfTrainingClassifier, whereas EM-based versions generally require a manual implementation.

When to use it

Choose semi-supervised logistic regression when labeled examples are few compared with a large pool of unlabeled data drawn from the same distribution, and when annotation is expensive. It fits settings such as text classification, clinical outcome prediction, and survey research where outcomes are only partially observed. Do not use it when the unlabeled data come from a different distribution than the labeled set (covariate shift), when labels are missing not at random and the missingness is informative, or when the labeled set is already large enough for a standard logistic regression to perform well. In those cases, pseudo-label errors can add more harm than benefit. The method rests on three assumptions: (1) a cluster or low-density assumption, under which class boundaries lie in low-density regions of the input space, so that unlabeled points help locate them; (2) labeled and unlabeled examples share the same class-conditional distribution of features; and (3) labels are missing at random given the features. When these assumptions fail, pseudo-labels can reinforce the model's early errors.

Limitations and considerations

  • If the initial labeled set is small or unrepresentative, the early pseudo-labels are noisy, and the errors carry forward through later iterations.
  • The approach assumes that the unlabeled data are drawn from the same distribution as the labeled data, which is often violated when records are collected at different times or from different sources.
  • Because EM converges to a local optimum, the final model is not guaranteed to outperform the supervised baseline.
  • The confidence threshold in self-training must be tuned, and its effect depends on class imbalance: a threshold that works for a rare class may admit many majority-class pseudo-labels.
  • Coefficient interpretation becomes harder because the effective training set includes algorithmically generated labels.

Source conditions do not replace independent scientific review or validation by an analysis engine.

Strengths

  • Makes use of a large pool of unlabeled examples to inform a logistic classifier without additional labeling cost.
  • Keeps the logistic form, so the coefficients retain their log-odds interpretation.
  • The self-training wrapper treats the base model as a black box that outputs class probabilities, so it can be added to an existing logistic regression pipeline.
  • The EM variant is derived from a likelihood, so each iteration does not decrease the observed-data likelihood; it converges, however, only to a local optimum.
  • L1 or L2 regularization can be combined with the retraining step to limit overfitting to pseudo-labels.

Applications

  • Clinical outcome prediction where only a subset of patients have confirmed diagnoses.
  • Text classification with large corpora and small expert-labeled training sets.
  • Survey research where respondents answer only a subset of outcome questions.
  • Sentiment analysis and opinion mining with partially annotated social-media data.
  • Fraud detection where confirmed fraud cases are rare but transaction volumes are large.
  • Medical imaging studies where radiologist labels are available for a subset of scans.

How it works

How it works

1

A standard logistic regression is fitted on the labeled examples. It models the probability of class 1 as P(y=1 | x) = 1/(1 + exp(-x^T beta)), with coefficients beta estimated by maximizing the labeled-data log-likelihood. This gives initial coefficient estimates and class-probability estimates for every observation. With few labels the starting model may be rough, and the later iterations are what refine it.

2

The trained model scores every unlabeled example and produces a posterior probability P(y=k | x) for each class. In self-training, an unlabeled example receives a hard pseudo-label only when its highest predicted probability exceeds a confidence threshold; the assigned label is then the argmax shown in the formula above. In EM-based variants, each unlabeled example instead receives soft memberships (its posterior probabilities across classes), so the hard-label formula above does not describe that variant.

Formula
\hat{y}_u = \arg\max_k \, p(y=k \mid x_u; \theta)
3

The logistic regression is refitted on the labeled examples together with the pseudo-labeled (or soft-labeled) unlabeled examples. With L2 regularization, the refit maximizes the log-likelihood minus a penalty proportional to the squared norm of beta; with L1 regularization, the penalty uses the absolute values of the coefficients. Regularization prevents the expanded dataset from pushing the coefficients too strongly toward the noisy pseudo-label signal.

4

The scoring and retraining steps are repeated until the solution stabilises, typically when the change in log-likelihood or in the coefficients between iterations falls below a small tolerance. The EM variant alternates formally between an E-step, which computes soft memberships r_ik = P(y=k | x_i; theta) for each unlabeled example x_i, and an M-step, which refits the coefficients by maximizing the expected complete-data log-likelihood under those memberships.

5

After convergence, the final model is evaluated on a held-out labeled test set using standard metrics such as accuracy, AUC, and F1. Cross-validation should be performed only on the labeled partition, so that information from the unlabeled pool does not leak into the validation estimate.

Common pitfalls

  • Including unlabeled examples in the validation or test set, which inflates performance estimates by leaking distributional information.
  • Setting a low confidence threshold that floods the training set with uncertain pseudo-labels, compounding early errors.
  • Ignoring class imbalance when assigning pseudo-labels, causing the majority class to dominate successive iterations.
  • Treating pseudo-labeled data as equivalent to truly labeled data in downstream uncertainty quantification or significance testing.
  • Skipping regularization on the expanded training set, allowing pseudo-label noise to drive overfitting.

Frequently asked questions

How is semi-supervised logistic regression different from standard logistic regression?

Standard logistic regression uses only labeled examples. The semi-supervised variant iteratively assigns tentative labels to unlabeled data and includes them in retraining, so the decision boundary is shaped by both confirmed labels and the structure of the larger unlabeled dataset.

What confidence threshold should I use for self-training?

No universal value exists, and none is recommended here. Choose the threshold on the labeled validation data, taking class balance and label quality into account. At each iteration, check the number of pseudo-labels accepted per class, not only the total: a single global threshold can admit many majority-class pseudo-labels while rejecting rare-class examples, and admitting too many uncertain pseudo-labels can compound early errors. When classes are imbalanced, consider class-specific thresholds or a cap on the number of pseudo-labels per class.

Can I still interpret the coefficients as odds ratios?

Yes, but with caution. The estimated coefficients retain the log-odds interpretation, but their confidence intervals are likely to be too narrow because pseudo-labeled data are treated as real observations. Inference about significance should rely only on the truly labeled portion.

What if my unlabeled data come from a different time period or source?

Distribution shift between labeled and unlabeled sets is one of the main failure modes. If the unlabeled data come from a different population or period, pseudo-labels may reinforce systematic errors. Check for covariate shift before proceeding.

Is there a ready-made implementation?

scikit-learn's SelfTrainingClassifier wraps any probabilistic classifier, including LogisticRegression, for self-training. The EM variant generally requires a manual implementation, or a dedicated semi-supervised learning library.

Related methods

Sources

  1. Nigam, K., McCallum, A., Thrun, S., & Mitchell, T. (2000). Text classification from labeled and unlabeled documents using EM. Machine Learning, 39, 103–134.

    Open DOI reference
  2. Chapelle, O., Scholkopf, B., & Zien, A. (Eds.) (2006). Semi-supervised Learning. MIT Press.

    ISBN: 978-0-262-03358-9