transform dataset into format accepted by libsvm