/** Shows how to construct a SparseInstance. */
 public static void main(String[] args) {
   /*
    * Here we will create an instance with 10 attributes, but will only set
    * the attributes with index 1,3 and 7 with a value.
    */
   /* Create instance with 10 attributes */
   Instance instance = new SparseInstance(10);
   /* Set the values for particular attributes */
   instance.put(1, 1.0);
   instance.put(3, 2.0);
   instance.put(7, 4.0);
 }
 public void filter(Instance inst) {
   for (int i = 0; i < inst.noAttributes(); i++) {
     if (Double.isNaN(inst.value(i)) || Double.isInfinite(inst.value(i))) inst.put(i, d);
   }
 }