Calculates data statistics, excluding NaN values.

@param data the data
@return the calculated statistics
542662
public static Statistics statisticsOf(CollectionNumber data) {
        IteratorNumber iterator = data.iterator();
        if (!iterator.hasNext()) {
            return null;
        }
        int count = 0;
        double min = iterator.nextDouble();
        while (Double.isNaN(min)) {
            if (!iterator.hasNext()) {
                return null;
            } else {
                min = iterator.nextDouble();
            }
        }
        double max = min;
        double total = min;
        double totalSquare = min*min;
        count++;
        
        while (iterator.hasNext()) {
            double value = iterator.nextDouble();
            if (!Double.isNaN(value)) {
                if (value > max)
                    max = value;
                if (value < min)
                    min = value;
                total += value;
                totalSquare += value*value;
                count++;
            }
        }
        
        double average = total/count;
        double stdDev = Math.sqrt(totalSquare / count - average * average);
        
        return new StatisticsImpl(count, min, max, average, stdDev);
    }
906762
public static int bitCount(final byte[] data) {
        int count = 0;
        for (final byte element : data) {
            byte bits = element;
            for (int j = 0; j < 8; j++) {
                if ((bits & 1) == 1) {
                    count++;
                }
                bits >>= 1;
            }
        }
        return count;
    }
1218378
public static Data toHeapData(Data data) {
        if (data == null || data instanceof HeapData) {
            return data;
        }
        return new HeapData(data.toByteArray());
    }
367357
public static IntMoments of(final IntMomentStatistics statistics) {
		return new IntMoments(
			statistics.getCount(),
			statistics.getMin(),
			statistics.getMax(),
			statistics.getSum(),
			statistics.getMean(),
			statistics.getVariance(),
			statistics.getSkewness(),
			statistics.getKurtosis()
		);
	}
289017
public static INDArray buildFromData(List<DataPoint> data) {
        INDArray ret = Nd4j.create(data.size(), data.get(0).getD());
        for (int i = 0; i < ret.slices(); i++)
            ret.putSlice(i, data.get(i).getPoint());
        return ret;
    }
373578
public static String datasetStats(Map<String, List<double[]>> data, String name) {

    int globalMinLength = Integer.MAX_VALUE;
    int globalMaxLength = Integer.MIN_VALUE;

    double globalMinValue = Double.MAX_VALUE;
    double globalMaxValue = Double.MIN_VALUE;

    for (Entry<String, List<double[]>> e : data.entrySet()) {
      for (double[] dataEntry : e.getValue()) {

        globalMaxLength = (dataEntry.length > globalMaxLength) ? dataEntry.length : globalMaxLength;
        globalMinLength = (dataEntry.length < globalMinLength) ? dataEntry.length : globalMinLength;

        for (double value : dataEntry) {
          globalMaxValue = (value > globalMaxValue) ? value : globalMaxValue;
          globalMinValue = (value < globalMinValue) ? value : globalMinValue;
        }

      }
    }
    StringBuffer sb = new StringBuffer();

    sb.append(name).append("classes: ").append(data.size());
    sb.append(", series length min: ").append(globalMinLength);
    sb.append(", max: ").append(globalMaxLength);
    sb.append(", min value: ").append(globalMinValue);
    sb.append(", max value: ").append(globalMaxValue).append(";");
    for (Entry<String, List<double[]>> e : data.entrySet()) {
      sb.append(name).append(" class: ").append(e.getKey());
      sb.append(" series: ").append(e.getValue().size()).append(";");
    }

    return sb.delete(sb.length() - 1, sb.length()).toString();
  }
171873
private List<?> convertDataToList(final Object data) {
		if (data == null) {
			return null;
		} else if (data instanceof List) {
			return (List<?>) data;
		} else if (data instanceof Object[]) {
			return Arrays.asList((Object[]) data);
		} else {
			return Arrays.asList(new Object[]{data});
		}
	}
627973
private static Data checkData(final Data data) {
		if (Data.EMPTY.equals(data)) {
			throw new IllegalStateException("Argument 'data' must not be empty.");
		}
		return data;
	}
583239
public static byte calc(byte[] data, int len) {
        byte crc = 0;

        for (int i = 0; i < len; i++)
            crc = CRC8_TABLE[(crc ^ data[i]) & 0xff];

        return crc;
    }
1071580
public static double max(final double[] data, final int startInclusive, final int endExclusive) {
    checkArgument(endExclusive > startInclusive);
    checkArgument(startInclusive >= 0);
    checkArgument(endExclusive <= data.length);

    double maxValue = Double.NEGATIVE_INFINITY;
    for (int i = startInclusive; i < endExclusive; ++i) {
      maxValue = Math.max(maxValue, data[i]);
    }
    return maxValue;
  }
367670
double[] findMinMax(double[] data) {

    double min = Double.MAX_VALUE;
    double max = -Double.MAX_VALUE;

    for (double dataPoint : data) {

      if (Double.isNaN(dataPoint)) {
        continue;
      } else {
        if (dataPoint < min) {
          min = dataPoint;
        }
        if (dataPoint > max) {
          max = dataPoint;
        }
      }
    }

    return new double[] {min, max};
  }
225466
def _parse_statistic(data, scale):
        """"""
        i = 0
        for byte in bytearray(data):
            i = (i << 8) + byte

        if i == 32768:
            return None

        if scale == 0:
            return i

        return float(i) / (scale * 10)
8254
public double[] toWraparoundOrder(double data[]){
    double newdata[] = new double[2*n];
    int nh = n/2;
    newdata[0]   = data[0];
    newdata[1]   = 0.0;
    newdata[n]   = data[1];
    newdata[n+1] = 0.0;
    for(int i=1; i<nh; i++){
      newdata[2*i]      = data[2*i];
      newdata[2*i+1]    = data[2*i+1];
      newdata[2*(n-i)]  = data[2*i];
      newdata[2*(n-i)+1]=-data[2*i+1]; }
    return newdata; }
596957
public static double of(double... data) {
    double sum = 0.;
    for(double v : data) {
      sum += v;
    }
    return sum / data.length;
  }
276399
public static double min(final double[] data, final int startInclusive, final int endExclusive) {
    checkArgument(endExclusive > startInclusive);
    checkArgument(startInclusive >= 0);
    checkArgument(endExclusive <= data.length);

    double minValue = Double.POSITIVE_INFINITY;
    for (int i = startInclusive; i < endExclusive; ++i) {
      minValue = Math.min(minValue, data[i]);
    }
    return minValue;
  }
61998
private void initData(final List<ChartData> DATA) {
        if (null == DATA || DATA.isEmpty()) {
            for (int i = 0; i < (getNoOfSectors() + 1); i++) { addData(new ChartData(0d)); }
        } else {
            setData(DATA);
        }
    }
573993
@Override
    public double f1Score(org.nd4j.linalg.dataset.api.DataSet data) {
        return f1Score(data.getFeatures(), data.getLabels());
    }