/** * Calculate the sample standard deviation of a 2D array. Calls * {@link DoubleArrayStatsUtils#var(double[][])} and does a Math.sqrt. * * @param arr * @return the standard deviation */ public static double std(double[][] arr) { return Math.sqrt(var(arr)); }
/** * Calculate the sample standard deviation of a 1D array. Calls * {@link DoubleArrayStatsUtils#var(double[])} and does a Math.sqrt. * * @param arr * @return the standard deviation */ public static double std(double[] arr) { return Math.sqrt(var(arr)); }
@Override public double[] normalise(double[] vector) { final double mean = DoubleArrayStatsUtils.mean(vector); final double var = DoubleArrayStatsUtils.var(vector); vector = ArrayUtils.subtract(vector, mean); vector = ArrayUtils.divide(vector, Math.sqrt(var + eps)); return vector; }