ClassificationEvaluationUtil implements Serializable { static Type judgeEvaluationType(Params params) { Type type; if (params.contains(EvalMultiClassParams.PREDICTION_DETAIL_COL)) { type = Type.PRED_DETAIL; } else if (params.contains(EvalMultiClassParams.PREDICTION_COL)) { type = Type.PRED_RESULT; } else { throw new IllegalArgumentException("Error Input, must give either predictionCol or predictionDetailCol!"); } return type; }  static Tuple3<Double, Boolean, Double> getBinaryDetailStatistics(Row row,
                                                                            Object[] tuple,
                                                                            TypeInformation labelType); static Tuple2<Map<Object, Integer>, Object[]> buildLabelIndexLabelArray(HashSet<Object> set,
                                                                                   boolean binary,
                                                                                   String positiveValue,
                                                                                   TypeInformation labelType); static Tuple2<Boolean, long[]> reduceBinaryPartitionSummary(List<BinaryPartitionSummary> values, int taskId); static boolean isMiddlePoint(Tuple3<Double, Boolean, Double> t); static void updateBinaryPartitionSummary(BinaryPartitionSummary statistics,
                                                    Tuple3<Double, Boolean, Double> t); static void updateAccurateBinaryMetricsSummary(Tuple3<Double, Boolean, Double> cur,
                                                          AccurateBinaryMetricsSummary binaryMetricsSummary,
                                                          long[] countValues,
                                                          double[] recordValues,
                                                          boolean first); static int DETAIL_BIN_NUMBER; static int TOTAL_TRUE; static int TOTAL_FALSE; static int CUR_TRUE; static int CUR_FALSE; static int RECORD_LEN; static int BINARY_LABEL_NUMBER; static Tuple3<Double, Boolean, Double> middlePoint; }
@Test public void judgeEvaluationTypeTest(){ Params params = new Params() .set(HasPredictionDetailCol.PREDICTION_DETAIL_COL, "detail"); ClassificationEvaluationUtil.Type type = ClassificationEvaluationUtil.judgeEvaluationType(params); Assert.assertEquals(type, ClassificationEvaluationUtil.Type.PRED_DETAIL); params.set(HasPredictionCol.PREDICTION_COL, "pred"); type = ClassificationEvaluationUtil.judgeEvaluationType(params); Assert.assertEquals(type, ClassificationEvaluationUtil.Type.PRED_DETAIL); params.remove(HasPredictionDetailCol.PREDICTION_DETAIL_COL); type = ClassificationEvaluationUtil.judgeEvaluationType(params); Assert.assertEquals(type, ClassificationEvaluationUtil.Type.PRED_RESULT); params.remove(HasPredictionCol.PREDICTION_COL); thrown.expect(RuntimeException.class); thrown.expectMessage("Error Input, must give either predictionCol or predictionDetailCol!"); ClassificationEvaluationUtil.judgeEvaluationType(params); }