public static double cosineToDistance(double cosAngle){
  return Math.sqrt(0.5 * (1 - cosAngle));
}

public static double cosineToDistance ( double cosAngle ) { return Math . sqrt ( 0.5 * ( 1 - cosAngle ) ) ; }
this method converts the cosine distance in [ - 1 , 1 ] to a valid distance metric in the range [ 0 , 1 ]
