Ask Your Question
0

SVM class count

asked 2017-01-03 20:11:06 -0600

vincentliu gravatar image

Hi there,

It should be a very simple question but I just can't found the way to get the class count from the SVM model instance, i.e., something like


Ptr<svm> svmModel = StatModel::load<svm>("xxx.yml");

int classCount = svmModel->getClassCount();


The variable classCount is stored in xxx.yml just like another variable VarConut. I found the method getVarCount() but fail to find getClassCount(), any suggestions? Thanks

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
2

answered 2017-01-03 21:16:50 -0600

Tetragramm gravatar image

You don't apparently. You have to open the FileStorage and read "class_count" manually. Which does seem like a bit of an oversight.

If it's a problem submit a request to the issue tracker asking for an improvement.

edit flag offensive delete link more

Comments

Ah well, a small workaround can be to retrieve the class weights and do a count. The number should be identical.

StevenPuttemans gravatar imageStevenPuttemans ( 2017-01-05 03:21:22 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2017-01-03 20:11:06 -0600

Seen: 295 times

Last updated: Jan 03 '17