private void init() { resultType = ClusteringType.parse( props.getObject(AlgParams.CLUSTERING_TYPE, ClusteringType.ROWS_CLUSTERING)); cutoffStrategy = CutoffStrategyFactory.getInstance().getDefault(); if (cutoffStrategy != null) { InternalEvaluatorFactory<E, Cluster<E>> ief = InternalEvaluatorFactory.getInstance(); cutoffStrategy.setEvaluator(ief.getDefault()); } noise = null; }
private void sortArray(double[] values, double min, double max) { Numeric ary[] = createArray(values); List<InternalEvaluator> eval = InternalEvaluatorFactory.getInstance().getAll(); for (InternalEvaluator e : eval) { subject.setEvaluator(e); Arrays.sort(ary, subject); if (e.isMaximized()) { // in fact this should be equal to Collections.reverseOrder() // first value is the best assertEquals(max, ary[0].getValue(), delta); // last is the worst assertEquals(min, ary[ary.length - 1].getValue(), delta); } else { assertEquals(min, ary[0].getValue(), delta); assertEquals(max, ary[ary.length - 1].getValue(), delta); } } }
private void sortNaN(double[] values, double min, double max) { Numeric ary[] = createArray(values); List<InternalEvaluator> eval = InternalEvaluatorFactory.getInstance().getAll(); for (InternalEvaluator e : eval) { subject.setEvaluator(e); System.out.println("testing " + e.getName() + " maximized: " + e.isMaximized()); Arrays.sort(ary, subject); System.out.println(Arrays.toString(ary)); if (e.isMaximized()) { // first value is the best assertEquals(max, ary[0].getValue(), delta); assertEquals(Double.NaN, ary[ary.length - 1].getValue(), delta); } else { assertEquals(min, ary[0].getValue(), delta); assertEquals(Double.NaN, ary[ary.length - 1].getValue(), delta); } } }