/** * Private helper method. * Assumes parameters have been validated. * @param values input data * @param begin index (0-based) of the first array element to include * @param length the number of elements to include * @return array of array of the most frequently occurring element(s) sorted in ascending order. */ private static double[] getMode(double[] values, final int begin, final int length) { // Add the values to the frequency table Frequency freq = new Frequency(); for (int i = begin; i < begin + length; i++) { final double value = values[i]; if (!Double.isNaN(value)) { freq.addValue(Double.valueOf(value)); } } List<Comparable<?>> list = freq.getMode(); // Convert the list to an array of primitive double double[] modes = new double[list.size()]; int i = 0; for(Comparable<?> c : list) { modes[i++] = ((Double) c).doubleValue(); } return modes; }
@Override public void informJobUnassigned(Job unassigned, Collection<String> failedConstraintNames) { if (!this.failedConstraintNamesFrequencyMapping.containsKey(unassigned.getId())) { this.failedConstraintNamesFrequencyMapping.put(unassigned.getId(), new Frequency()); } for (String r : failedConstraintNames) { if (failedConstraintNamesToBeIgnored.contains(r)) continue; this.failedConstraintNamesFrequencyMapping.get(unassigned.getId()).addValue(r); } }
public PercentileRank(Integer min, Integer max){ freqTable = new Frequency(); this.min = min; this.max = max; }
public CmhTableRow(Object rowValue){ this.rowValue = rowValue; columns = new Frequency(); mean = new Mean(); }
@Override public void informJobUnassigned(Job unassigned, Collection<String> failedConstraintNames) { if (!this.reasons.containsKey(unassigned.getId())) { this.reasons.put(unassigned.getId(), new Frequency()); } for (String r : failedConstraintNames) { if (constraintsToBeIgnored.contains(r)) continue; this.reasons.get(unassigned.getId()).addValue(r); } }
public CmhTable(Object focalCode, Object referenceCode){ this.focalRow = new CmhTableRow(focalCode); this.referenceRow = new CmhTableRow(referenceCode); columnMargin = new Frequency(); }
/** * Private helper method. * Assumes parameters have been validated. * @param values input data * @param begin index (0-based) of the first array element to include * @param length the number of elements to include * @return array of array of the most frequently occurring element(s) sorted in ascending order. */ private static double[] getMode(double[] values, final int begin, final int length) { // Add the values to the frequency table Frequency freq = new Frequency(); for (int i = begin; i < begin + length; i++) { final double value = values[i]; if (!Double.isNaN(value)) { freq.addValue(Double.valueOf(value)); } } List<Comparable<?>> list = freq.getMode(); // Convert the list to an array of primitive double double[] modes = new double[list.size()]; int i = 0; for(Comparable<?> c : list) { modes[i++] = ((Double) c).doubleValue(); } return modes; }
/** * Private helper method. * Assumes parameters have been validated. * @param values input data * @param begin index (0-based) of the first array element to include * @param length the number of elements to include * @return array of array of the most frequently occurring element(s) sorted in ascending order. */ private static double[] getMode(double[] values, final int begin, final int length) { // Add the values to the frequency table Frequency freq = new Frequency(); for (int i = begin; i < begin + length; i++) { final double value = values[i]; if (!Double.isNaN(value)) { freq.addValue(Double.valueOf(value)); } } List<Comparable<?>> list = freq.getMode(); // Convert the list to an array of primitive double double[] modes = new double[list.size()]; int i = 0; for(Comparable<?> c : list) { modes[i++] = ((Double) c).doubleValue(); } return modes; }
public void addValue(Comparable<?> rowValue, Comparable<?> colValue){ Frequency ft=tableRows.get(rowValue); if(ft==null){ ft=new Frequency(); ft.addValue(colValue); tableRows.put(rowValue,ft); }else{ ft.addValue(colValue); } rowMargin.addValue(rowValue); //addValue row margins colMargin.addValue(colValue); //addValue column margins totalCount++; }
Frequency frequency = new Frequency();
Frequency freq = new Frequency(); String responseString = "";
Frequency freq = new Frequency(); for(int i=0;i<tap.length;i++){ freq.addValue(Arrays.toString(tap[i]));
public ReflexValue frequency(List<ReflexValue> params) { if (params.size() != 1) { throw new ReflexException(-1, "frequency needs one list parameter"); } if (!params.get(0).isList()) { throw new ReflexException(-1, "frequency needs one list parameter"); } Frequency f = new Frequency(); List<ReflexValue> values = params.get(0).asList(); for (ReflexValue v : values) { f.addValue(v.asDouble()); } return new ReflexValue(f); }
Frequency categoryFreq = new Frequency();
public PolyserialPlugin(){ r = new PearsonCorrelation(); sdX = new StandardDeviation(); sdY = new StandardDeviation(); freqY = new Frequency(); norm = new NormalDistribution(); }
public void summarize(double[] x, int[] y){ if(x.length!=y.length) throw new IllegalArgumentException("X and Y are of different lengths."); N = (double) x.length; Mean meanX = new Mean(); StandardDeviation sdX = new StandardDeviation(); PearsonCorrelation rxy = new PearsonCorrelation(); Frequency table = new Frequency(); for(int i=0;i<N;i++){ meanX.increment(x[i]); sdX.increment(x[i]); rxy.increment(x[i], (double)y[i]); table.addValue(y[i]); } //compute thresholds int nrow = table.getUniqueCount(); double[] freqDataY = new double[nrow]; double ntotal = table.getSumFreq(); for(int i=0;i<(nrow-1);i++){ freqDataY[i] = table.getCumFreq(i+1); thresholds[i] = norm.inverseCumulativeProbability(freqDataY[i]/ntotal); } thresholds[nrow-1] = 10;//set last threshold to a large number less than infinity }
public void summarize()throws DimensionMismatchException{ if(dataX.length!=dataY.length) throw new DimensionMismatchException(dataX.length, dataY.length); Frequency table = new Frequency(); meanX = new Mean(); sdX = new StandardDeviation(); rxy = new PearsonCorrelation(); for(int i=0;i<nrow;i++){ meanX.increment(dataX[i]); sdX.increment(dataX[i]); rxy.increment(dataX[i], (double)dataY[i]); table.addValue(dataY[i]); } //compute thresholds nrow = table.getUniqueCount(); freqDataY = new double[nrow]; double ntotal = table.getSumFreq(); for(int i=0;i<(nrow-1);i++){ freqDataY[i] = table.getCumFreq(i+1); alpha[i] = normal.inverseCumulativeProbability(freqDataY[i]/ntotal); } alpha[nrow-1] = 10;//set last threshold to a large number less than infinity }
final Frequency freq = new Frequency(); String itemPath, itemId; long itemOffset;
public void testPoissonDistribution() { final double length = poisson.getLength(); final Frequency f = new Frequency();