ArticleslgStudy

computer science

Domain adaptation

Domain adaptation is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Domain adaptation rather than just read about it. In short: Domain adaptation is a field associated with machine learning and transfer learning. It addresses the challenge of training a model on one data distribution (the source domain) and applying it to a related but different data distribution (the target domain).

Domain adaptation — main illustration
Domain adaptation — illustration

Key takeaways

  • Domain adaptation belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Domain adaptation to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Domain adaptation from memory before moving on to harder problems.

Reference excerpt

Domain adaptation is a field associated with machine learning and transfer learning. It addresses the challenge of training a model on one data distribution (the source domain) and applying it to a related but different data distribution (the target domain). A common example is spam filtering, where a model trained on emails from one user (source domain) is adapted to handle emails for another user with significantly different patterns (target domain). Domain adaptation techniques can also leverage unrelated data sources to improve learning. When multiple source distributions are involved, the problem extends to multi-source domain adaptation. Domain adaptation is a specific type of transfer learning. According to the taxonomy laid out by Pan and Yang (2010), it falls into the category of transductive transfer learning. In this setting, the source and target tasks are the same (e.g., both are object recognition), but the domains differ (different marginal distributions). This distinguishes it from inductive transfer learning (where labeled data is available for the target task) and unsupervised transfer learning (where labels are unavailable in both domains).

Classification of domain adaptation problems Domain adaptation setups are classified in two different ways: according to the distribution shift between the domains, and according to the available data from the target domain.

Distribution shifts Common distribution shifts are classified as follows:

Covariate Shift occurs when the input distributions of the source and destination change, but the relationship between inputs and labels remains unchanged. The above-mentioned spam filtering example typically falls in this category. Namely, the distributions (patterns) of emails may differ between the domains, but emails labeled as spam in the one domain should similarly be labeled in another. Prior Shift (Label Shift) occurs when the label distribution differs between the source and target datasets, while the conditional distribution of features given labels remains the same. An example is a classifier of hair color in images from Italy (source domain) and Norway (target domain). The proportions of hair colors (labels) differ, but images within classes like blond and black-haired populations remain consistent across domains. A classifier for the Norway population can exploit this prior knowledge of class proportions to improve its estimates. Concept Shift (Conditional Shift) refers to changes in the relationship between features and labels, even if the input distribution remains the same. For instance, in medical diagnosis, the same symptoms (inputs) may indicate entirely different diseases (labels) in different populations (domains).

Data available during training Domain adaptation problems typically assume that some data from the target domain is available during training. Problems can be classified according to the type of this available data:

Unsupervised: Unlabeled data from the target domain is available, but no labeled data. In the above-mentioned example of spam filtering, this corresponds to the case where emails from the target domain (user) are available, but they are not labeled as spam. Domain adaptation methods can benefit from such unlabeled data, by comparing its distribution (patterns) with the labeled source domain data. Semi-supervised: Most data that is available from the target domain is unlabelled, but some labeled data is also available. In the above-mentioned case of spam filter design, this corresponds to the case that the target user has labeled some emails as being spam or not. Supervised: All data that is available from the target domain is labeled. In this case, domain adaptation reduces to refinement of the source domain predictor. In the above-mentioned example classification of hair-color from images, this could correspond to the refinement of a network already trained on a large dataset of labeled images from Italy, using newly available labeled images from Norway.

Formalization Let X be the input space (or description space) and let Y be the output space (or label space). The objective of a machine learning algorithm is to learn a mathematical model (a hypothesis) h:X→Y able to attach a label from Y to an example from X. This model is learned from a learning sample S={(xi,yi)∈(X×Y)}i=1m. Usually in supervised learning (without domain adaptation), we suppose that the examples (xi,yi)∈S are drawn i.i.d. from a distribution DS of support X×Y (unknown and fixed). The objective is then to learn h (from S) such that it commits the least error possible for labelling new examples coming from the distribution DS. The main difference between supervised learning and domain adaptation is that in the latter situation we study two different (but related) distributions DS and DT on X×Y. The domain adaptation task then consists of the transfer of knowledge from the source domain DS to the target one DT. The goal is then to learn h (from labeled or unlabelled samples coming from the two domains) such that it commits as little error as possible on the target domain DT. The major issue is the following: if a model is learned from a source domain, what is its capacity to correctly label data coming from the target domain?

Four algorithmic principles

Reweighting algorithms The objective is to reweight the source labeled sample such that it "looks like" the target sample (in terms of the error measure considered).

Iterative algorithms A method for adapting consists in iteratively "auto-labeling" the target examples. The principle is simple:

a model h is learned from the labeled examples; h automatically labels some target examples; a new model is learned from the new labeled examples. Note that there exist other iterative approaches, but they usually need target labeled examples.

Search of a common representation space The goal is to find or construct a common representation space for the two domains. The objective is to obtain a space in which the domains are close to each other while keeping good performances on the source labeling task. This can be achieved through the use of Adversarial machine learning techniques where feature representations from samples in different domains are encouraged to be indistinguishable.

… excerpt ends here. Continue reading the full article.

Illustrations

Domain adaptation: Taxonomy of transfer learning based on Pan & Yang (2010). Domain adaptation falls under transductive transfer learning (same task, different domain, no target labels).
Taxonomy of transfer learning based on Pan & Yang (2010). Domain adaptation falls under transductive transfer learning (same task, different domain, no target labels).

Worked examples

Example 1 — a first encounter with Domain adaptation

Start with the simplest possible case. Write down what Domain adaptation claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Domain adaptation before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Domain adaptation ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Domain adaptation

In research
Domain adaptation appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Domain adaptation in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Domain adaptation is common in secondary-school and first-year university syllabi. It links to neighbouring topics Machine learning, so understanding it makes those chapters shorter.
In everyday life
Look for Domain adaptation outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Domain adaptation” →

How to study Domain adaptation in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Domain adaptation means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Domain adaptation out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Domain adaptation in simple terms?

Domain adaptation is a field associated with machine learning and transfer learning. It addresses the challenge of training a model on one data distribution (the source domain) and applying it to a related but different data distribution (the target domain).

Why does Domain adaptation matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Domain adaptation?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Domain adaptation.

Tags

  • Machine learning

Keep exploring