public void normalize() { for (int i = 0; i < samples.size(); i++) { TreeSet<Column.Entry> entries = new TreeSet<Column.Entry>(); for (int j = 0; j < cols.size(); j++) { Column c = cols.get(j); if (c.values.get(i) != null) { entries.add(c.entry(i)); } } int ns = entries.size(); int j = 0; for (Column.Entry e : entries) { int cidx = ids.get(e.id()); float ff = (float) j / (float) ns; cols.get(cidx).values.set(i, ff); } if (i > 0) { if (i % 100 == 0) { System.out.print("."); System.out.flush(); } } } System.out.println(); }
public void outputBinary(DataOutputStream dos) throws IOException { dos.writeInt(samples.size()); for (String s : samples) { dos.writeUTF(s); } dos.writeInt(cols.size()); for (Column c : cols) { c.outputBinary(dos); } }