// ================================ BUILD ================================
public void build(int labelCutoff, int featureCutoff, int randomSeed, boolean initialize)
{
SparseFeatureVector vector;
StringInstance instance;
int label;
if (initialize) init();
buildLabels(labelCutoff);
buildFeatures(featureCutoff);
l_instances = Lists.newArrayList();
r_shuffle = new Random(randomSeed);
l_indices = new IntArrayList();
while ((instance = i_collector.pollInstance()) != null)
{
if ((label = getLabelIndex(instance.getLabel())) < 0)
continue;
vector = toSparseFeatureVector(instance.getFeatureVector());
if (!vector.isEmpty())
{
l_instances.add(new IntInstance(label, vector));
l_indices.add(l_indices.size());