add write_libsvm method.