@Override public BasicMatrix train(BasicMatrix input) throws Exception { input.map( new MatrixMapper() { @Override public void map(int row, int col, float value) { docCounts.adjustOrPutValue(col, 1, 1); } }); N = input.rows(); return process(input); }
@Override public BasicMatrix process(final BasicMatrix input) throws Exception { input.map( new MatrixMapper() { @Override public void map(int row, int col, float value) { input.set(row, col, tf((int) value) * idf(col)); } }); return input; }