Similarity-based transfer learning