[Python] Python libsvm: TypeError: __init__() got an unexpected keyword argument 'kernel_type'

Discussão em 'Python' iniciado por Stack, Junho 22, 2025.

  1. Stack

    Stack Membro Participativo

    I was trying to execute the libsvm example given at https://stackoverflow.com/a/4215056 but I get the error TypeError mentioned in the title.

    from svm import *
    prob = svm_problem([1,-1],[[1,0,1],[-1,0,-1]])
    param = svm_parameter(kernel_type = LINEAR, C = 1)
    ## training the model
    m = svm_model(prob, param)
    #testing the model
    m.predict([1, 1, 1])

    Error:
    param = svm_parameter(kernel_type = LINEAR, C = 1)
    TypeError: __init__() got an unexpected keyword argument 'kernel_type'

    Continue reading...

Compartilhe esta Página