-
Notifications
You must be signed in to change notification settings - Fork 342
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem running the example for testing LIBLINEAR with instance weight support #83
Comments
Looks like you already have liblinear in the system but would like to
use the liblinear "weight" extension?
If you run this example in the directory
liblinear-weights-2.45/python
I believe the weight code instead of the system package will be called
first
…On 2022-08-24 12:41, Kuncheng Song wrote:
I recently installed the LIBLINEAR and was testing the example scripts
that were part of the README.weight
The following codes work until the problem() command
from liblinear.liblinearutil import *
import csv
y, x = svm_read_problem('./heart_scale', return_scipy=True)
W = [1] * len(y)
W[0] = 10
prob = problem(W, y, x) # Error occurs here
The error code is shown here:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File
"/home/ksong4/miniconda3/lib/python3.7/site-packages/liblinear/liblinear.py",
line 194, in __init__
tmp_xi, tmp_idx = gen_feature_nodearray(xi)
File
"/home/ksong4/miniconda3/lib/python3.7/site-packages/liblinear/liblinear.py",
line 106, in gen_feature_nodearray
raise TypeError('xi should be a dictionary, list, tuple, 1-d numpy
array, or tuple of (index, data)')
TypeError: xi should be a dictionary, list, tuple, 1-d numpy array, or
tuple of (index, data)
The imported x and y are both lists using the provided example
heart_scale file.
--
Reply to this email directly, view it on GitHub [1], or unsubscribe
[2].
You are receiving this because you are subscribed to this
thread.Message ID: ***@***.***> [ {
***@***.***": "http://schema.org", ***@***.***": "EmailMessage",
"potentialAction": { ***@***.***": "ViewAction", "target":
"#83", "url":
"#83", "name": "View Issue"
}, "description": "View this Issue on GitHub", "publisher": { ***@***.***":
"Organization", "name": "GitHub", "url": "https://github.com" } } ]
Links:
------
[1] #83
[2]
https://github.com/notifications/unsubscribe-auth/ABI3BHTDZFK3YBTZLVKJVRDV2WRYLANCNFSM57NZYF2A
|
Thank you so much for your prompt and helpful commands; I was indeed in the wrong directory when running the example. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I recently installed the LIBLINEAR and was testing the example scripts that were part of the README.weight
The following codes work until the problem() command
The error code is shown here:
The imported x and y are both lists using the provided example heart_scale file.
The text was updated successfully, but these errors were encountered: