@Override public double getDouble(int id) { assert id < _idToValueMap.size(); return _idToValueMap.get(id); }
@Override public double getScore() { return scores.get(index); }
/** * {@inheritDoc} * * @deprecated Please use the corresponding type-specific method instead. */ @Deprecated @Override public Double get(final int i) { return list.get(i); } /**
/** * {@inheritDoc} * * @deprecated Please use the corresponding type-specific method instead. */ @Deprecated @Override public Double get(final int i) { synchronized (sync) { return list.get(i); } } /**
@Override public double getUnboxedChannelValue(Symbol sym) { DoubleList array = unboxedChannels.get(sym); if (array != null) { return array.get(index); } else { throw new NullPointerException("no symbol " + sym); } }
@Override protected double sd(int n) { return (n > 0 && n <= sis.size()) ? mus.get(n-1) : 0; }
@Override protected double mean(int n) { return (n > 0 && n <= mus.size()) ? mus.get(n-1) : Double.NEGATIVE_INFINITY; }
private static void doSwap(DoubleList doubles, int i, int j) { doubles.set(i, doubles.set(j, doubles.get(i))); } private static <T> void doSwap(List<T> objs, int i, int j) {
public double[] getMetricValues() { DoubleList estimates = accumulator.estimates(); double[] result = new double[estimates.size() + 1]; // put the validation score in first position in the result: result[0] = validationScore / (double) n; for (int i=1;i<estimates.size()+1;i++) { result[i]=estimates.get(i-1); } // Array.copy(estimates.toDoubleArray(), 1, result, 0, estimates.size() + 1); return result; // return new double[]{validationScore / (double) n}; // return accumulator.createOutputStatistics(metrics); }
/** * Create a map from an array and index mapping. * * @param mapping The index mapping specifying the keys. * @param values The array of values. * @return A sparse vector mapping the IDs in {@code map} to the values in {@code values}. * @throws IllegalArgumentException if {@code values} not the same size as {@code idx}. */ public static Long2DoubleSortedArrayMap fromArray(KeyIndex mapping, DoubleList values) { Preconditions.checkArgument(values.size() == mapping.size(), "value array and index have different sizes: " + values.size() + " != " + mapping.size()); final int n = values.size(); double[] nvs = new double[n]; SortedKeyIndex index = SortedKeyIndex.fromCollection(mapping.getKeyList()); for (int i = 0; i < n; i++) { long item = index.getKey(i); int origIndex = mapping.getIndex(item); nvs[i] = values.get(origIndex); } return wrap(index, nvs); }
return accumulator.estimates().get(0);