@Override
    public Predictors<MultiClassLabel> process(Predictors<Collection<MultiClassLabel>> input) throws Exception {
        Predictors<MultiClassLabel> res = new Predictors<MultiClassLabel>(input.size());
        for(int i = 0; i<input.size(); i++) {
            Collection<MultiClassLabel> sets = input.get(i);
            TIntIntMap counters = new TIntIntHashMap();
            for(MultiClassLabel set : sets){
                for(int v : set.getClasses()) {
                    counters.adjustOrPutValue(v, 1, 1);
                }
            }
            int[] values = counters.values();
            Arrays.sort(values);
            final int threshold = values.length > N ? values[values.length - N] : 0;
            if (threshold <= 1){
                getContext().getProgressReporter().reportWarning("Top three threshold is too low, not enough data? ");
            }
            final TIntSet r = new TIntHashSet();
            counters.forEachEntry(new TIntIntProcedure() {
                @Override
                public boolean execute(int a, int b) {
                    if (b >= threshold){
                        r.add(a);
                    }
                    return true;
                }
            });
            res.set(i,  new MultiClassLabel(r.toArray()));
        }
        return res;
    }