public static < T extends Vector > double getSimilarity ( SimType similarityType , T a , T b ) { switch ( similarityType ) { case COSINE : return cosineSimilarity ( a , b ) ; case PEARSON_CORRELATION : return correlation ( a , b ) ; case EUCLIDEAN : return euclideanSimilarity ( a , b ) ; case SPEARMAN_RANK_CORRELATION : return spearmanRankCorrelationCoefficient ( a , b ) ; case JACCARD_INDEX : return jaccardIndex ( a , b ) ; case AVERAGE_COMMON_FEATURE_RANK : return averageCommonFeatureRank ( a , b ) ; case LIN : return linSimilarity ( a , b ) ; case KL_DIVERGENCE : return klDivergence ( a , b ) ; case KENDALLS_TAU : return kendallsTau ( a , b ) ; case TANIMOTO_COEFFICIENT : return tanimotoCoefficient ( a , b ) ; } return 0 ; }
Calculates the similarity of the two vectors using the provided similarity measure .