连接向量时Python中的分段错误

2024-10-02 00:36:52 发布

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

我正在Linux服务器上运行Python脚本。 它基于sciket learncount vectorizer。sciketlearn的一部分是用Cython编写的,因此使用了C扩展。你知道吗

只要向量的数量是有限的,一切都正常,但如果数量增加,它 给出一个分段错误。 我认为代码出错的地方就在这里:

def train(bodies, y_train, analyzetype, ngrammax, table, dim, features):
vectorizer = CountVectorizer(input='content', 
                             analyzer=char, 
                             tokenizer=tokenize,
                             ngram_range=(1,4),
                             lowercase=False
                             )
X_train = combine(vectorizer.fit_transform(bodies), 
                  embeddings(bodies, table, dim),
                  features)

我已经设置堆栈大小为无限使用

ulimit -s unlimited

这并没有解决问题。你知道吗

我还尝试通过显示所有行号来跟踪问题。但不幸的是,我无法使this工作。你知道吗


Tags: 服务器脚本数量linuxtabletrain向量cython

热门问题