@Test public void testEuclideanWeighhted() { logger.info("euclideanWeighhted"); AssociativeArray a1 = new AssociativeArray(getMap1()); AssociativeArray a2 = new AssociativeArray(getMap2()); Map<Object, Double> columnWeights = getWeights(); double expResult = 2.449489742783178; double result = Distance.euclideanWeighted(a1, a2, columnWeights); assertEquals(expResult, result, Constants.DOUBLE_ACCURACY_HIGH); }
public static double euclideanWeighted(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()) { double columnDistance = entry.getValue(); distance+=(columnDistance*columnDistance)*columnWeights.get(entry.getKey()); } return Math.sqrt(distance); }
Distance { public static double euclideanWeighted(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()) { double columnDistance = entry.getValue(); distance+=(columnDistance*columnDistance)*columnWeights.get(entry.getKey()); } return Math.sqrt(distance); } }
Distance { public static double euclideanWeighted(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()) { double columnDistance = entry.getValue(); distance+=(columnDistance*columnDistance)*columnWeights.get(entry.getKey()); } return Math.sqrt(distance); }  }
Distance { public static double euclideanWeighted(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()) { double columnDistance = entry.getValue(); distance+=(columnDistance*columnDistance)*columnWeights.get(entry.getKey()); } return Math.sqrt(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 euclideanWeighted(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()) { double columnDistance = entry.getValue(); distance+=(columnDistance*columnDistance)*columnWeights.get(entry.getKey()); } return Math.sqrt(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);  }