0

我很长时间尝试安装 shogun 库以使用 StringSubsecuenceKernel。最后我为python 2.7做了它。我使用了这个站点另一个答案中的代码示例

from shogun.Features import *
from shogun.Kernel import *
from shogun.Classifier import *
from shogun.Evaluation import *
from modshogun import StringCharFeatures, RAWBYTE
from shogun.Kernel import StringSubsequenceKernel
import numpy
strings = ['cat', 'doom', 'car', 'boom']
test = ['bat', 'soon']
train_labels  = numpy.array([1, -1, 1, -1])
test_labels = numpy.array([1, -1])
features = StringCharFeatures(strings, RAWBYTE)
test_features = StringCharFeatures(test, RAWBYTE)
# 1 is n and 0.5 is lambda as described in Lodhi 2002
sk = StringSubsequenceKernel(features, features, 2, 0.5)

然后当我尝试这样做时

del sk

它给了我以下错误

Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)

我正在使用 pycharm 社区版 2017.2.4 并且 shogun 库安装在/usr/lib/python2.7/dist-packages/shogun 通常安装的包出现在 /usr/local/lib/python2.7/dist-packages 目录中,但这没有。问题是,为什么我会收到此错误以及如何避免它?感谢你的回答。

4

1 回答 1

0

你用的shogun是什么版本的?

于 2017-11-05T18:18:46.460 回答