进程结束,退出代码139(由信号11:SIGSEGV中断),StringSubsequenceKern

2024-06-16 12:40:23 发布

您现在位置:Python中文网/ 问答频道 /正文

我花了很长时间尝试安装shogun库来使用stringsubsecurencekernel。最后,我为Python2.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)

当我试着这么做的时候

^{pr2}$

它给出了以下错误

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目录中,但这不是。 问题是,为什么我会犯这个错误,我怎样才能避免它? 谢谢你的回答。在


Tags: fromtestimportnumpylabelsis错误array