2015-08-30 82 views
2

我試圖從這裏使用代碼:https://github.com/pystruct/pystruct/blob/master/examples/multi_label.pyPyStruct - 沒有匹配的簽名找到

我已經X_train與形狀(2591, 256)與形狀(2591, 175) y_train。當我運行此:

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) 

我得到這個:

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 
    for 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 

當我直接從該鏈接運行的代碼,它的工作原理(與他們的數據集)。有誰知道應該是什麼問題?

回答