@Override public int put(double value) { int id = _valueToIdMap.get(value); if (id == INVALID_KEY) { id = _idToValueMap.size(); _valueToIdMap.put(value, id); _idToValueMap.add(value); } return id; }
@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(); }
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(); } }
/** * Add the error for a training round. * @param err The error for the training round. * @return The builder (for chaining). */ public Builder addTrainingRound(double err) { trainingError.add(err); return this; } }
@Override public boolean add(double key) { return list.add(key); } @Override
@Override public void add(final int i, final double k) { synchronized (sync) { list.add(i, k); } } @Override
/** * Add the error for a training round. * @param err The error for the training round. * @return The builder (for chaining). */ public Builder addTrainingRound(double err) { trainingError.add(err); return this; } }
/** * {@inheritDoc} * * @deprecated Please use the corresponding type-specific method instead. */ @Deprecated @Override public void add(final int i, Double k) { synchronized (sync) { list.add(i, k); } } /**
/** * {@inheritDoc} * * @deprecated Please use the corresponding type-specific method instead. */ @Deprecated @Override default void add(int index, Double key) { add(index, (key).doubleValue()); } /**
/** * {@inheritDoc} * <p> * This method specification is a workaround for * <a href="http://bugs.java.com/bugdatabase/view_bug.do?bug_id=JDK-8177440">bug * 8177440</a>. * * @deprecated Please use the corresponding type-specific method instead. */ @Deprecated @Override default boolean add(Double k) { return add((k).doubleValue()); } /**
@Override public boolean add(final double k) { l.add(to, k); to++; assert assertRange(); return true; } @Override
@Override public void add(long index, double key) { list.add(intIndex(index), key); } @Override
@Override public void add(final int index, final double k) { ensureIndex(index); l.add(from + index, k); to++; assert assertRange(); } @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(); }
static <C, T> Schedule<C, T> create(C context, ImmutableList<ImmutableList<T>> routes, IntList startIndices, RouteEvaluator<C, T> routeEvaluator) { final DoubleList costs = new DoubleArrayList(routes.size()); double sumCost = 0; for (int i = 0; i < routes.size(); i++) { final double cost = routeEvaluator.computeCost(context, i, routes.get(i)); costs.add(cost); sumCost += cost; } return new Schedule<C, T>( context, routes, IntLists.unmodifiable(new IntArrayList(startIndices)), DoubleLists.unmodifiable(costs), sumCost, routeEvaluator); }