@Override public DoubleColumn bottom(final int n) { DoubleArrayList bottom = new DoubleArrayList(); double[] values = data.toDoubleArray(); DoubleArrays.parallelQuickSort(values); for (int i = 0; i < n && i < values.length; i++) { bottom.add(values[i]); } return new DoubleColumn(name() + "[Bottoms " + n + "]", bottom); }
@Override public DoubleColumn top(int n) { DoubleArrayList top = new DoubleArrayList(); double[] values = data.toDoubleArray(); DoubleArrays.parallelQuickSort(values, descendingComparator); for (int i = 0; i < n && i < values.length; i++) { top.add(values[i]); } return new DoubleColumn(name() + "[Top " + n + "]", top); }
@Override public DoubleColumn lag(int n) { final int srcPos = n >= 0 ? 0 : 0 - n; final double[] dest = new double[size()]; final int destPos = n <= 0 ? 0 : n; final int length = n >= 0 ? size() - n : size() + n; for (int i = 0; i < size(); i++) { dest[i] = FloatColumnType.missingValueIndicator(); } double[] array = data.toDoubleArray(); System.arraycopy(array, srcPos, dest, destPos, length); return new DoubleColumn(name() + " lag(" + n + ")", new DoubleArrayList(dest)); }
/** * Returns the result of a Kolmogorov Smirnov test * @param otherAlgorithm - * @return the p-value result of a Kolmogorov Smirnov test. */ public double getSmirnoffPValue(HypothesisTestableMetric otherAlgorithm){ return new KolmogorovSmirnovTest().kolmogorovSmirnovTest(getDetailedResults().toDoubleArray(), otherAlgorithm.getDetailedResults().toDoubleArray()); } }
/** * Returns the result of a two-tailed paired t-test. * Since n should always be greater 30, normality can be assumed. * @param otherAlgorithm - * @return the p-value result of a paired t-test */ public double getTTestPValue(HypothesisTestableMetric otherAlgorithm){ return new TTest().pairedTTest(getDetailedResults().toDoubleArray(), otherAlgorithm.getDetailedResults().toDoubleArray()); }
this.score = score.toDoubleArray();
oos.writeObject(mus.toDoubleArray()); oos.writeObject(sds.toDoubleArray()); oos.writeObject(unigrams); oos.writeObject(str2key);
/** * Returns the largest ("top") n values in the column * * @param n The maximum number of records to return. The actual number will be smaller if n is greater than the * number of observations in the column * @return A list, possibly empty, of the largest observations */ public DoubleArrayList top(int n) { DoubleArrayList top = new DoubleArrayList(); double[] values = data.toDoubleArray(); DoubleArrays.parallelQuickSort(values, reverseFloatComparator); for (int i = 0; i < n && i < values.length; i++) { top.add(values[i]); } return top; }
/** * Returns the smallest ("bottom") n values in the column * * @param n The maximum number of records to return. The actual number will be smaller if n is greater than the * number of observations in the column * @return A list, possibly empty, of the smallest n observations */ public DoubleArrayList bottom(int n) { DoubleArrayList bottom = new DoubleArrayList(); double[] values = data.toDoubleArray(); DoubleArrays.parallelQuickSort(values); for (int i = 0; i < n && i < values.length; i++) { bottom.add(values[i]); } return bottom; }
@Override public DoubleColumn bottom(final int n) { DoubleArrayList bottom = new DoubleArrayList(); double[] values = data.toDoubleArray(); DoubleArrays.parallelQuickSort(values); for (int i = 0; i < n && i < values.length; i++) { bottom.add(values[i]); } return new DoubleColumn(name() + "[Bottoms " + n + "]", bottom); }
@Override public DoubleColumn top(int n) { DoubleArrayList top = new DoubleArrayList(); double[] values = data.toDoubleArray(); DoubleArrays.parallelQuickSort(values, descendingComparator); for (int i = 0; i < n && i < values.length; i++) { top.add(values[i]); } return new DoubleColumn(name() + "[Top " + n + "]", top); }
private void serializeList(final DataOutput out, final List list) throws IOException { Class oCls = list.getClass(); if (oCls.equals(IntArrayList.class)) { serialize(out, ((IntArrayList) list).toIntArray()); } else if (oCls.equals(FloatArrayList.class)) { serialize(out, ((FloatArrayList) list).toFloatArray()); } else if (oCls.equals(DoubleArrayList.class)) { serialize(out, ((DoubleArrayList) list).toDoubleArray()); } else if (oCls.equals(ShortArrayList.class)) { serialize(out, ((ShortArrayList) list).toShortArray()); } else if (oCls.equals(ByteArrayList.class)) { serialize(out, ((ByteArrayList) list).toByteArray()); } else if (oCls.equals(LongArrayList.class)) { serialize(out, ((LongArrayList) list).toLongArray()); } else if (oCls.equals(BooleanArrayList.class)) { serialize(out, ((BooleanArrayList) list).toBooleanArray()); } else if (oCls.equals(CharArrayList.class)) { serialize(out, ((CharArrayList) list).toCharArray()); } else { serialize(out, list.size()); for (Object obj : list) { serialize(out, obj); } } }
private void serializeList(final DataOutput out, final List list) throws IOException { Class oCls = list.getClass(); if (oCls.equals(IntArrayList.class)) { serialize(out, ((IntArrayList) list).toIntArray()); } else if (oCls.equals(FloatArrayList.class)) { serialize(out, ((FloatArrayList) list).toFloatArray()); } else if (oCls.equals(DoubleArrayList.class)) { serialize(out, ((DoubleArrayList) list).toDoubleArray()); } else if (oCls.equals(ShortArrayList.class)) { serialize(out, ((ShortArrayList) list).toShortArray()); } else if (oCls.equals(ByteArrayList.class)) { serialize(out, ((ByteArrayList) list).toByteArray()); } else if (oCls.equals(LongArrayList.class)) { serialize(out, ((LongArrayList) list).toLongArray()); } else if (oCls.equals(BooleanArrayList.class)) { serialize(out, ((BooleanArrayList) list).toBooleanArray()); } else if (oCls.equals(CharArrayList.class)) { serialize(out, ((CharArrayList) list).toCharArray()); } else { serialize(out, list.size()); for (Object obj : list) { serialize(out, obj); } } }
@Override public DoubleColumn lag(int n) { final int srcPos = n >= 0 ? 0 : 0 - n; final double[] dest = new double[size()]; final int destPos = n <= 0 ? 0 : n; final int length = n >= 0 ? size() - n : size() + n; for (int i = 0; i < size(); i++) { dest[i] = FloatColumnType.missingValueIndicator(); } double[] array = data.toDoubleArray(); System.arraycopy(array, srcPos, dest, destPos, length); return new DoubleColumn(name() + " lag(" + n + ")", new DoubleArrayList(dest)); }
@Override public void end() { if (elementClass == boolean.class) { parent.add(((BooleanArrayList) container).toBooleanArray()); } else if (elementClass == byte.class) { parent.add(((ByteArrayList) container).toByteArray()); } else if (elementClass == char.class) { parent.add(((CharArrayList) container).toCharArray()); } else if (elementClass == short.class) { parent.add(((ShortArrayList) container).toShortArray()); } else if (elementClass == int.class) { parent.add(((IntArrayList) container).toIntArray()); } else if (elementClass == long.class) { parent.add(((LongArrayList) container).toLongArray()); } else if (elementClass == float.class) { parent.add(((FloatArrayList) container).toFloatArray()); } else if (elementClass == double.class) { parent.add(((DoubleArrayList) container).toDoubleArray()); } else { parent.add(((ArrayList) container).toArray()); } }
performanceValues); performanceLogger.logMetrics("epochs", numExamplesUsed, epoch, metricValues.toDoubleArray()); performanceLogger.logTrainingScore("epochs", epoch, trainingScore); if (args().trackingStyle == TrainingArguments.TrackStyle.PERFS) { bestValue = validationMetricValue; performanceLogger.logMetrics(bestMetricName, numExamplesUsed, epoch, metricValues.toDoubleArray()); notImproved = 0; } else {