Transfer learning is a foundational approach to learning.
In this article we will use the binary classification as the main task of interest.
Transfer learning involves the concepts of a domain and task. A domain consists of a feature space and a marginal probability distribution where
Given a domain , and task as a label space and a conditional probability distribution that is typically learned from the training data .
Given a source domain , a corresponding source task and a target domain with a corresponding target task , the objective of transfer learning is to learn the target conditional probability distribution from the information gained from and .
We assume that a far smaller number of labeled examples of the target domain exist as compared to the labeled examples of the source domain.
There are three main possibilities in our binary classification problem.
. For example the domain of images of nature and the domain of images of houses. The domain of documents in English and in French. The domain of numbers in Arabic and the domain of numbers in Latin.
. Both distributions are generated by the same domain but the marginals are different and therefore this case is known as domain adaptation. For example the domain of English documents with marginals obtained from documents of different topics. Another example is shown here where the marginals are different because different people have different physiologies in their hands and EMG signals are sensed for a person sometimes quite differently than others. Finally the classic domain adaptation example: spoken English with the marginals referring to different accents.
This is the most common scenario where we use the task we learned in the source domain to improve our learning of the target domain.
Take for example the case of a pretrained network on MS COCO dataset that includes cars amongst 79 other classes. We now want to train a network to classify sports-cars. These tasks are very similar, even partly overlapping, so you should try to reuse parts of the first network.

More generally, transfer learning will work best when the inputs have similar low-level features.

Because these low-level features(lines, dots) are captured in the lower layers of the network as shown above, we reuse the base of the network. Similarly, the upper hidden layers of the original model are less likely to be as useful as the lower layers, since the high-level features that are most useful for the new task may differ significantly from the ones that were most useful for the original task. You need to find the right number of layers to reuse.
You also need to replace the output layer.