python - PyStruct - No matching signature find -
i'm trying use code here: https://github.com/pystruct/pystruct/blob/master/examples/multi_label.py
i have x_train shape (2591, 256)
, y_train shape (2591, 175)
. when run this:
tree = chow_liu_tree(y_train) tree_model = multilabelclf(edges=tree, inference_method="max-product") tree_ssvm = oneslackssvm(tree_model, inference_cache=50, c=.1, tol=0.01) print("fitting tree model...") tree_ssvm.fit(x_train, y_train)
i got this:
traceback (most recent call last): file "classifiers.py", line 173, in <module> tree_ssvm.fit(x_train, y_train) file "/usr/local/lib/python2.7/dist-packages/pystruct/learners/one_slack_ssvm.py", line 448, in fit x, y, joint_feature_gt, constraints) file "/usr/local/lib/python2.7/dist-packages/pystruct/learners/one_slack_ssvm.py", line 348, in _find_new_constraint x, y, self.w, relaxed=true) file "/usr/local/lib/python2.7/dist-packages/pystruct/models/base.py", line 95, in batch_loss_augmented_inference x, y in zip(x, y)] file "/usr/local/lib/python2.7/dist-packages/pystruct/models/crf.py", line 106, in loss_augmented_inference loss_augment_unaries(unary_potentials, np.asarray(y), self.class_weight) file "utils.pyx", line 21, in utils.__pyx_fused_cpdef (src/utils.c:4341) typeerror: no matching signature found
when run code directly link, works (with dataset). know should problem?
in case error too, y
must of type int - got float.
link solution: https://groups.google.com/forum/#!searchin/pystruct/matching/pystruct/t6ukegzlmxy/297olyql8u8j
Comments
Post a Comment