cjlin1 / libsvm

LIBSVM -- A Library for Support Vector Machines
https://www.csie.ntu.edu.tw/~cjlin/libsvm/
BSD 3-Clause "New" or "Revised" License
4.55k stars 1.64k forks source link

Error when use svm_model.sv_indices #177

Open wly93 opened 3 years ago

wly93 commented 3 years ago

i got the type of sv_indices is "ctypes.wintypes.LP_c_long" how can i convert it to numpy array or a list

wly93 commented 3 years ago

i used libsvm in python

cjlin1 commented 3 years ago

but I think it's a list:

s = m.get_sv_indices() s [3, 14, 29, 38, 41, 45, 47, 48, 59, 60, 68, 70, 82, 83, 92, 94, 95, 96, 98, 102, 106, 109, 111, 113, 117, 130, 131, 132, 138, 143, 145, 147, 161, 162, 170, 176, 178, 179, 183, 192, 194, 204, 209, 211, 227, 231, 232, 234, 241, 244, 249, 253, 259, 263, 265, 2, 4, 5, 6, 11, 12, 15, 16, 20, 24, 25, 27, 30, 32, 53, 61, 65, 67, 72, 73, 74, 75, 77, 84, 85, 86, 88, 97, 99, 107, 119, 125, 129, 135, 136, 140, 142, 144, 154, 159, 165, 166, 169, 171, 181, 185, 186, 188, 191, 197, 201, 208, 210, 212, 218, 219, 226, 233, 235, 239, 245, 257, 267, 269] type(s) <class 'list'>

On 2021-07-15 17:26, wly93 wrote:

i got the type of sv_indices is "ctypes.wintypes.LP_c_long" how can i convert it to numpy array or a list

-- You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub [1], or unsubscribe [2]. [ { @.": "http://schema.org", @.": "EmailMessage", "potentialAction": { @.": "ViewAction", "target": "https://github.com/cjlin1/libsvm/issues/177", "url": "https://github.com/cjlin1/libsvm/issues/177", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { @.": "Organization", "name": "GitHub", "url": "https://github.com" } } ]

Links:

[1] https://github.com/cjlin1/libsvm/issues/177 [2] https://github.com/notifications/unsubscribe-auth/ABI3BHXD52ZVX6OSCX2JWFLTX2STRANCNFSM5ANEXSYQ