Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8551399
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T14:11:13+00:00 2026-06-11T14:11:13+00:00

It seems like every SVM library for C++ is either Disallowing custom kernels or

  • 0

It seems like every SVM library for C++ is either

  1. Disallowing custom kernels or
  2. Linux exclusive and would be a holy pain to use with Visual Studio.

Are there any SVM libraries currently available that support custom kernels and are usable in Visual Studio (specifically, 2010)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T14:11:14+00:00Added an answer on June 11, 2026 at 2:11 pm

    Like I said, it’s easy to modify libsvm for what you need and here’s the explanation: http://www.csie.ntu.edu.tw/~cjlin/libsvm/faq.html#f418

    Since I’m not familiar with those two kernels, I just copied the formulas from Google. I hope I got them right 😀

    A. Histogram intersection kernel (too bad SO doesn’t render Latex): SUM(min(x_i, y_i)) -> we can just change the linear kernel and transform it into this one, so, basically, in version 3.12 (latest version), in svm.cpp:

    -> line 233 return dot(x[i],x[j]); – you just have to copy the code from the Kernel::dot method and change it accordingly, so something like this:

    double sum = 0;
    while(x->index != -1 && y->index != -1)
    {
        if(x->index == y->index)
        {
            sum += min(x->value, y->value);
            ++x;
            ++y;
        }
        else
        {
            if(x->index > y->index)
                ++x;
            else
                ++y;
        }           
    }
    return sum;
    

    (for normal test files, x should have the same length as y. I think the else branch exists for special cases when the test or model file contains attributes with value 0, that can be omitted, but if libsvm produces the expected results with a linear kernel, then it will work OK with this modified one also)

    -> line 322 return dot(x,y); – same as above

    B. Chi-square kernel: SUM((2 x_i y_i) / (x_i + y_i)) – well, let’s see… I think we can try again to modify the linear kernel (maybe some of the optimizations for RBF can be exploited in this case, but let’s ignore that for now):

    -> line 233 becomes:

    double sum = 0;
    while(x->index != -1 && y->index != -1)
    {
        if(x->index == y->index)
        {
            sum += 2 * x->value * y->value / (x->value + y->value);
            ++x;
            ++y;
        }
        else
        {
            if(x->index > y->index)
                ++x;
            else
                ++y;
        }           
    }
    return sum;
    

    -> line 322 – same as above

    PS: The above code is written in notepad and untested. Please don’t kill me if it doesn’t work and you have to spend two weeks debugging cryptic C code. [sarcasm]For me it worked from the first try.[/sarcasm] Nevertheless, you can debug it easily once you understand the workflow, by putting break points in those two places. If you run into issues, I’d be happy to provide more help, so just let me know if you get stuck.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Seems like every time i go thru a required update of either the mac
It seems like every time I float two elements to the right, they get
Seriously, it seems like every time I want to make my UI elements talk
This seems like it should be something very easy to do, but every time
Fortran->Algol->Cpl->Bcpl->C->C++->Java ..... Seems like every language is built upon an ancestor language. My question
I would like to select every column of a table, but want to have
It seems like every time I learn a new platform, I have to re-solve
It seems like every unit test example I've encountered is incredibly obvious and canned.
In PHP, it seems like every object can be converted to an integer, just
I am getting this weird error, it seems like every time I edit the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.