f_weights = new FloatArrayList();
}
public void trimFeatures(Logger log, float threshold)
{
FloatArrayList tWeights = new FloatArrayList(f_weights.size());
IntIntOpenHashMap map = new IntIntOpenHashMap();
ObjectIntHashMap<String> m;
int i, j, tFeatures = 1;
boolean trim;
String s;
log.info("Trimming: ");
// bias
for (j=0; j<n_labels; j++)
tWeights.add(f_weights.get(j));
// rest
for (i=1; i<n_features; i++)
{
trim = true;
for (j=0; j<n_labels; j++)
{
if (Math.abs(f_weights.get(i*n_labels+j)) > threshold)
{
trim = false;
break;
}
}
if (!trim)
{
map.put(i, tFeatures++);
for (j=0; j<n_labels; j++)
tWeights.add(f_weights.get(i*n_labels+j));
}
}
log.info(String.format("%d -> %d\n", n_features, tFeatures));
tWeights.trimToSize();
// map
for (String type : Lists.newArrayList(m_features.keySet()))
{
m = m_features.get(type);