protected String instanceToLibsvm(Instance inst){
  StringBuffer result;
  int i;
  result=new StringBuffer("" + inst.classValue());
  for (i=0; i < inst.numAttributes(); i++) {
    if (i == inst.classIndex()) {
      continue;
    }
    if (inst.value(i) == 0) {
      continue;
    }
    result.append(" " + (i + 1) + ":"+ inst.value(i));
  }
  return result.toString();
}

protected String instanceToLibsvm ( Instance inst ) { StringBuffer result ; int i ; result = new StringBuffer ( "" + inst . classValue ( ) ) ; for ( i = 0 ; i < inst . numAttributes ( ) ; i ++ ) { if ( i == inst . classIndex ( ) ) { continue ; } if ( inst . value ( i ) == 0 ) { continue ; } result . append ( " " + ( i + 1 ) + ":" + inst . value ( i ) ) ; } return result . toString ( ) ; }
turns the instance into a libsvm row
