@Test public void testManhattanWeighhted() { logger.info("manhattanWeighhted"); AssociativeArray a1 = new AssociativeArray(getMap1()); AssociativeArray a2 = new AssociativeArray(getMap2()); Map<Object, Double> columnWeights = getWeights(); double expResult = 5.0; double result = Distance.manhattanWeighted(a1, a2, columnWeights); assertEquals(expResult, result, Constants.DOUBLE_ACCURACY_HIGH); }
public static double manhattanWeighted(AssociativeArray a1, AssociativeArray a2, Map<Object, Double> columnWeights) { Map<Object, Double> columnDistances = columnDistances(a1, a2, columnWeights.keySet()); double distance = 0.0; for(Map.Entry<Object, Double> entry : columnDistances.entrySet()) { distance+=Math.abs(entry.getValue())*columnWeights.get(entry.getKey()); } return distance; }
Distance { public static double manhattanWeighted(AssociativeArray a1, AssociativeArray a2, Map<Object, Double> columnWeights) { Map<Object, Double> columnDistances = columnDistances(a1, a2, columnWeights.keySet()); double distance = 0.0; for(Map.Entry<Object, Double> entry : columnDistances.entrySet()) { distance+=Math.abs(entry.getValue())*columnWeights.get(entry.getKey()); } return distance; } }
Distance { public static double manhattanWeighted(AssociativeArray a1, AssociativeArray a2, Map<Object, Double> columnWeights) { Map<Object, Double> columnDistances = columnDistances(a1, a2, columnWeights.keySet()); double distance = 0.0; for(Map.Entry<Object, Double> entry : columnDistances.entrySet()) { distance+=Math.abs(entry.getValue())*columnWeights.get(entry.getKey()); } return distance; }  }
Distance { public static double manhattanWeighted(AssociativeArray a1, AssociativeArray a2, Map<Object, Double> columnWeights) { Map<Object, Double> columnDistances = columnDistances(a1, a2, columnWeights.keySet()); double distance = 0.0; for(Map.Entry<Object, Double> entry : columnDistances.entrySet()) { distance+=Math.abs(entry.getValue())*columnWeights.get(entry.getKey()); } return distance; }  static double euclidean(AssociativeArray a1, AssociativeArray a2); static double euclideanWeighted(AssociativeArray a1, AssociativeArray a2, Map<Object, Double> columnWeights); static double manhattan(AssociativeArray a1, AssociativeArray a2); static double manhattanWeighted(AssociativeArray a1, AssociativeArray a2, Map<Object, Double> columnWeights); static double maximum(AssociativeArray a1, AssociativeArray a2); }
Distance { public static double manhattanWeighted(AssociativeArray a1, AssociativeArray a2, Map<Object, Double> columnWeights) { Map<Object, Double> columnDistances = columnDistances(a1, a2, columnWeights.keySet()); double distance = 0.0; for(Map.Entry<Object, Double> entry : columnDistances.entrySet()) { distance+=Math.abs(entry.getValue())*columnWeights.get(entry.getKey()); } return distance; }  static double euclidean(AssociativeArray a1, AssociativeArray a2); static double euclideanWeighted(AssociativeArray a1, AssociativeArray a2, Map<Object, Double> columnWeights); static double manhattan(AssociativeArray a1, AssociativeArray a2); static double manhattanWeighted(AssociativeArray a1, AssociativeArray a2, Map<Object, Double> columnWeights); static double maximum(AssociativeArray a1, AssociativeArray a2);  }