Libsvm: scale data using python

Libsvm provides a binary for scaling data i.e. svm-scale. How can I scale data to the normalized values using the Python. And then how do I do the scaling for the test samples?


Probably A Mammal
Are you using data analysis software (e.g., SPSS or R) to analyze this data? If so, I would wonder why you don't just do the scaling with that software (R has a "scale" function). In any case, a quick look at some of the LIBSVM documentation showed the syntax to be like:

svm-scale -s scaling_parameters train_data > scaled_train_data
Really, you can't get anymore simple than that. Read the online documentation for what flags and parameters you can use to satisfy your request.
As I originally mentioned, I want to do this inside the Python code I am writing. Calling the binary for each of the test samples would make the system very slow and coding it as such will be unclean.