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 7703881
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T23:33:36+00:00 2026-05-31T23:33:36+00:00

We are two students who want to use one-class svm for dectection of summary

  • 0

We are two students who want to use one-class svm for dectection of summary worthy sentences in text documents. We have already implemented sentence similarity functions for sentences, which we have used for another algorithm. We would now want to use the same functions as kernels for a one-class svm in libsvm for java.

We are using the PRECOMPUTED enum for the kernel_type field in our svm_parameter (param). In the x field of our svm_problem (prob) we have the kernel matrix on the form:

0:i 1:K(xi,x1) ... L:K(xi,xL) 

where K(x,y) is the kernel value for the similarity of x and y, L is the number of sentences to compare and i is the current row index (0 to L).
The training of the kernel (svm.svm_train(prob, param)) seems to get sometimes get “stuck” in what seems like a infinite loop.

Have we missunderstood how to use the PRECOMPUTED enum, or does the problem lay elsewhere?

  • 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-05-31T23:33:37+00:00Added an answer on May 31, 2026 at 11:33 pm

    We solved this problem

    It turns out that the “series numbers” in the first column needs to go from 1 to L, not 0 to L-1, which was our initial numbering. We found this out by inspecting the source in svm.java:

    double kernel_function(int i, int j)
    {
        switch(kernel_type)
        {
            /* ... snip ...*/
            case svm_parameter.PRECOMPUTED:
                return x[i][(int)(x[j][0].value)].value;
            /* ... snip ...*/
        }
    }
    

    The reason for starting the numbering at 1 instead of 0, is that the first column of a row is used as column index when returning the value K(i,j).

    Example

    Consider this Java matrix:

    double[][] K = new double[][] {
        double[] { 1,   1.0,   0.1,   0.0,   0.2 },
        double[] { 2,   0.5,   1.0,   0.1,   0.4 },
        double[] { 3,   0.2,   0.3,   1.0,   0.7 },
        double[] { 4,   0.6,   0.5,   0.5,   1.0 }
    };
    

    Now, libsvm needs the kernel value K(i,j) for say i=1 and j=3. The expression x[i][(int)(x[j][0].value)].value will break down to:

    x[i]    -> x[1]    -> second row in K          -> [2,   0.5,   1.0,   0.1,   0.4]
    x[j][0] -> x[3][0] -> fourth row, first column -> 4
    x[i][(int)(x[j][0].value)].value -> x[1][4]    -> 0.4
    

    This was a bit messy to realize at first, but changing the indexing solved our problem. Hopefully this might help someone else with similar problems.

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

Sidebar

Related Questions

I have two Entities University courses Course students i want to access all the
I want to get a list of all students who were at one of
I have two tables. Student and Job. I need to search students who possess
So I have two tables students (PK sID) and mentors (PK pID). This query
I have two collections as below which hold IDs for Students. The ids are
I have two student objects. class Student{ int physics; int english; int chemistry; }
I have two tables. In the one table I have a list of dorm
I have two tables as students and certificates, I need to delete the certificates
I have to calculate the average of students scores. Students have two different scores:
I have these two tables: desc students +-----------------------+---------+------+-----+---------+----------------+ | Field | Type | Null

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.