Semi-supervised learning using similarity and dissimilarity