cjlin1 / libsvm

LIBSVM -- A Library for Support Vector Machines
https://www.csie.ntu.edu.tw/~cjlin/libsvm/
BSD 3-Clause "New" or "Revised" License
4.57k stars 1.64k forks source link

How to load svm problem file into a variant in the type of "svm_problem" #52

Open cuckootan opened 9 years ago

cuckootan commented 9 years ago

I can't find the interface that loads svm problem file into a variant in the type of "svm_problem", because it is very necessary before training a svm model. Can I fix it in another way?

mricherzhagen commented 8 years ago

I think read_problem in svm-train.cpp is what you are looking for: https://github.com/cjlin1/libsvm/blob/master/svm-train.c#L278-L379

Sadly this function uses a lot of global variables, so it cannot be reused easily. (it writes into svm_problem prob)