@Test public void testCompare(){ Assert.assertEquals(EvaluationUtil.compare(1L, 2L), -1); Assert.assertEquals(EvaluationUtil.compare(1L, null), 1); thrown.expect(RuntimeException.class); thrown.expectMessage("Input Labels are not comparable!"); EvaluationUtil.compare(1L, 0.1); }
public static int compare(Object o1, Object o2) { if(o1 == null || o2 == null){ return (o1 == null) && (o2 == null) ? 0 : 1; } if(o1 instanceof Comparable && o2 instanceof Comparable && o1.getClass() == o2.getClass()){ return ((Comparable)o1).compareTo((Comparable)o2); }else { throw new RuntimeException("Input Labels are not comparable!"); } }
EvaluationUtil implements Serializable { public static int compare(Object o1, Object o2) { if(o1 == null || o2 == null){ return (o1 == null) && (o2 == null) ? 0 : 1; } if(o1 instanceof Comparable && o2 instanceof Comparable && o1.getClass() == o2.getClass()){ return ((Comparable)o1).compareTo((Comparable)o2); }else { throw new RuntimeException("Input Labels are not comparable!"); } } }
EvaluationUtil implements Serializable { public static int compare(Object o1, Object o2) { if(o1 == null || o2 == null){ return (o1 == null) && (o2 == null) ? 0 : 1; } if(o1 instanceof Comparable && o2 instanceof Comparable && o1.getClass() == o2.getClass()){ return ((Comparable)o1).compareTo((Comparable)o2); }else { throw new RuntimeException("Input Labels are not comparable!"); } }  }
EvaluationUtil implements Serializable { public static int compare(Object o1, Object o2) { if(o1 == null || o2 == null){ return (o1 == null) && (o2 == null) ? 0 : 1; } if(o1 instanceof Comparable && o2 instanceof Comparable && o1.getClass() == o2.getClass()){ return ((Comparable)o1).compareTo((Comparable)o2); }else { throw new RuntimeException("Input Labels are not comparable!"); } }  static boolean labelCompare(Object label1, Object label2, TypeInformation type); static int compare(Object o1, Object o2); static Object castTo(Object x, TypeInformation t); static BaseMetricsSummary getDetailStatistics(Iterable<Row> rows, String positiveValue, boolean binary, TypeInformation labelType); static BaseMetricsSummary getDetailStatistics(Iterable<Row> rows,
                                                         boolean binary,
                                                         Tuple2<Map<Object, Integer>, Object[]> labels,
                                                         TypeInformation labelType); static boolean checkRowFieldNotNull(Row row); static double extractLogloss(TreeMap<Object, Double> labelProbMap, Object label); static TreeMap<Object, Double> extractLabelProbMap(Row row, TypeInformation labelType); static void updateBinaryMetricsSummary(TreeMap<Object, Double> labelProbMap,
                                                  Object label,
                                                  BinaryMetricsSummary binaryMetricsSummary); static void updateMultiMetricsSummary(TreeMap<Object, Double> labelProbMap,
                                                 Object label,
                                                 Map<Object, Integer> labels,
                                                 MultiMetricsSummary multiMetricsSummary); static RegressionMetricsSummary getRegressionStatistics(Iterable<Row> rows); static MultiMetricsSummary getMultiClassMetrics(Iterable<Row> rows,
                                                           Tuple2<Map<Object, Integer>, Object[]>
                                                               labelIndexLabelArray); }
EvaluationUtil implements Serializable { public static int compare(Object o1, Object o2) { if(o1 == null || o2 == null){ return (o1 == null) && (o2 == null) ? 0 : 1; } if(o1 instanceof Comparable && o2 instanceof Comparable && o1.getClass() == o2.getClass()){ return ((Comparable)o1).compareTo((Comparable)o2); }else { throw new RuntimeException("Input Labels are not comparable!"); } }  static boolean labelCompare(Object label1, Object label2, TypeInformation type); static int compare(Object o1, Object o2); static Object castTo(Object x, TypeInformation t); static BaseMetricsSummary getDetailStatistics(Iterable<Row> rows, String positiveValue, boolean binary, TypeInformation labelType); static BaseMetricsSummary getDetailStatistics(Iterable<Row> rows,
                                                         boolean binary,
                                                         Tuple2<Map<Object, Integer>, Object[]> labels,
                                                         TypeInformation labelType); static boolean checkRowFieldNotNull(Row row); static double extractLogloss(TreeMap<Object, Double> labelProbMap, Object label); static TreeMap<Object, Double> extractLabelProbMap(Row row, TypeInformation labelType); static void updateBinaryMetricsSummary(TreeMap<Object, Double> labelProbMap,
                                                  Object label,
                                                  BinaryMetricsSummary binaryMetricsSummary); static void updateMultiMetricsSummary(TreeMap<Object, Double> labelProbMap,
                                                 Object label,
                                                 Map<Object, Integer> labels,
                                                 MultiMetricsSummary multiMetricsSummary); static RegressionMetricsSummary getRegressionStatistics(Iterable<Row> rows); static MultiMetricsSummary getMultiClassMetrics(Iterable<Row> rows,
                                                           Tuple2<Map<Object, Integer>, Object[]>
                                                               labelIndexLabelArray);  }