private static double[] filterDoubles(DoubleSet doubleSet, double[] source) { DoubleList doubleList = new DoubleArrayList(); for (double value : source) { if (doubleSet.contains(value)) { doubleList.add(value); } } if (doubleList.size() == source.length) { return source; } else { return doubleList.toDoubleArray(); } }
@Override public double[] toDoubleArray() { return list.toDoubleArray(); } @Override
/** * A method that can evaluate several metrics in one pass over a validation set. Metric values are * returned in the order of the metrics names provided as arguments. * Note that the default implementation is not optimal because it performs several * passes over the validation set. A custom implementation can often improve on this. * * @param graph model. * @param dataSetIterator iterator over validation set. * @param scoreN number of examples to score. * @param metrics name of metrics to estimate. * @return an array of metric values. */ public double[] estimateMetric(ComputationGraph graph, MultiDataSetIterator dataSetIterator, long scoreN, String... metrics) { DoubleList results = new DoubleArrayList(); for (String metricName : metrics) { results.add(estimateMetric(graph, metricName, dataSetIterator, scoreN)); } return results.toDoubleArray(); }
@Override protected double[] createOutputStatistics() { DoubleList values = new DoubleArrayList(); values.addAll(DoubleArrayList.wrap(stats.createOutputStatistics(orderStats))); auc = aucLossCalculator.evaluateStatistic(); confidenceInterval95 = aucLossCalculator.confidenceInterval95(); values.add(auc); values.add(confidenceInterval95[0]); values.add(confidenceInterval95[1]); return values.toDoubleArray(); }