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

  • SEARCH
  • Home
  • 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 9196391
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T21:50:24+00:00 2026-06-17T21:50:24+00:00

I want to subclass the LibSvm object class exported from the mlpy machine learning

  • 0

I want to subclass the LibSvm object class exported from the mlpy machine learning package:

from mlpy import MaximumLikelihoodC, LibSvm 

class Svm(LibSvm):   

def __init__(self,Gs,ls):
    self._K = ls.shape[1]
    self._Gs = Gs
    self._N = Gs.shape[1]
    self._ls = ls
    LibSvm.__init__('c_svc','rbf',\
            gamma=1.0/self._N,C=100,probability=True)

When I call the constructor, e.g.,

svm = Svm(Gs,ls)

the interpreter ignores my init and executers the init method of LibSvm, giving an error

svm = SVM(Gs,ls)  
File "libsvm.pyx", line 146, in mlpy.libsvm.LibSvm.__cinit__ mlpy/libsvm/libsvm.c:1803)
ValueError: invalid svm_type

I have no problem subclassing MaximumLikelihoodC using the same syntax.

  • 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-17T21:50:25+00:00Added an answer on June 17, 2026 at 9:50 pm

    Python classes that are implemented in C cannot be subclassed unless they are specially designed for it, see Which classes cannot be subclassed?.

    By the looks of the error message, it seems pretty certain its implemented in C, and I expect the author didn’t put in the extra work to make it subclassable.

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

Sidebar

Related Questions

I want to subclass an S4 class and add a special method to that
I want to subclass a class called ASIFormDataRequest which is in my project target
Considering some security issues, I don't want the subclass inherit the static method from
I want to subclass the list type and have slicing return an object of
I want to dynamically subclass a class (say NSString) and instantiate that subclass for
Here is what I want to achieve: I want to subclass an UIScrollView to
I want my UIView subclass to behave so that when it is fitted in
I want my AbstracttableModel subclass data() method to return html i.e. PreText<b>Text</b>PostText And this
I want to use an NSFormatter subclass to format the contents of an NSPopUpButton
I want a non-editable TextField (or a subclass) that doesn't even have the caret

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.