public static<E> double jensenShannonDivergence(Counter<E> x, Counter<E> y) {
	  double sum = 0.0;
	  double xTotal = x.totalCount();
	  double yTotal = y.totalCount();
	  for (E key: x.keySet()) {
		//x -> x+y/2
		double xVal = x.getCount(key) / xTotal;
		double yVal = y.getCount(key) / yTotal;
		double avg = 0.5 * (xVal + yVal);
		sum += xVal * Math.log(xVal / avg);
	  }
	  for (E key: y.keySet()) {
			//y -> x+y/2
			double xVal = x.getCount(key)/ xTotal ;
			double yVal = y.getCount(key) / yTotal;
			double avg = 0.5 * (xVal + yVal);
			sum += yVal * Math.log(yVal / avg);
	  }
	  return sum / 0.5;
  }