// try two different method, inner dot or cos private static double GetCwobScore(DoubleVec vec1, DoubleVec vec2) { //double score = DoubleVecUtil.GetInnerDot(vec1, vec2); // normailzed score between -1.0 to 1.0 double score = DoubleVecUtil.GetCosineSimilarity(vec1, vec2); return(score); }
// private method private static double GetSimilarityScore(DoubleVec vec1, DoubleVec vec2) { double score = DoubleVecUtil.GetCosineSimilarity(vec1, vec2); // set the min. to 0.0 score = (score <= 0.0 ? 0.0d : score); return(score); }
// use cosineSimilarity instead of inner dot private static double GetInnerDotScore(DoubleVec vec1, DoubleVec vec2) { double score = DoubleVecUtil.GetInnerDot(vec1, vec2); // set the min. to 0.0 // it seems -score is useful for split .... //score = (score <= 0.0?0.0d:score); return(score); }