我很长时间尝试安装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目录中,但这并不是。
问题是,为什么我得到这个错误,我怎么能避免它?
谢谢你的回答。
答案 0 :(得分:0)
你使用幕府将军的版本是什么?