Options

"Support Vector ID"

dragoljubdragoljub Member Posts: 241 Contributor II
edited May 2019 in Help
Hi Everyone,

First of all thanks for this great Data Mining Platform!

I am using the LibSVM operator and would like to know the ID (the exact sample from the training set) corresponding to the support vectors found after optimization.

Basically for a set of data I would like to know which data samples are the support vectors.

What is the simplest way to accomplish this. The support vector table view only shows the label and a counter but not the actual sample ID.

In addition the support vector table changes the attribute value names, is it possible to preserve the names in the support vector view?

Thanks,
-Gagi
Tagged:

Answers

  • Options
    fischerfischer Member Posts: 439 Maven
    Hi,

    Unfortunately, this is currently not possible. But you certainly have a point there. We should implement that for a future version.

    Best,
    Simon
  • Options
    dragoljubdragoljub Member Posts: 241 Contributor II
    If you are using the open source LibSVM C++ version I can point you in the right direction.

    Starting on line 1659 in svm.cpp we see a bit of code where all the support vectors are counted, a simple line of code can be used to print or save the index "i"  which will give you the number (starting at zero) of the sample in the training set that was found to be a support vector. I have used this modification to great advantage for many learning problems.

    Is there any way I can make this modification to Rapid Miner and recompile?

    Thanks,
    -Gagi

    // output SVs

    int nSV = 0;
    int nBSV = 0;
    for(int i=0;i<prob->l;i++)
    {
    if(fabs(alpha) > 0)
    {

                            printf("%d\n", i+1); //<--PRINTS SUPPORT VECTOR INDEX!

                            ++nSV;
    if(prob->y > 0)
    {
    if(fabs(alpha) >= si.upper_bound_p)
    ++nBSV;
    }
    else
    {
    if(fabs(alpha) >= si.upper_bound_n)
    ++nBSV;
    }
    }
    }

    info("nSV = %d, nBSV = %d\n",nSV,nBSV);
  • Options
    landland RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 2,531 Unicorn
    Hi,
    I don't think that this solution would help. We will have to change something on the interfacing classes between the LibSVM and RapidMiner. Just printing will probably print the information into nowhere. Just saving doesn't include the information into the result table.

    Did you try the JMySVM? I'm not sure, but I think the result table was somehow different. Might be worth a try if the id's are included there.

    Greetings,
      Sebastian
Sign In or Register to comment.