为什么GridSearchCV在{method'acquire'of'上花费超过50%的时间螺纹锁紧'对象}?

2024-06-12 20:25:56 发布

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

最近我正在调整我的一些机器学习管道。我决定利用我的多核处理器。我用paramn_jobs=-1运行交叉验证。我还对其进行了分析,让我感到惊讶的是:最重要的功能是:

{method 'acquire' of 'thread.lock' objects}

我不确定这是否是我的错,因为我在Pipeline中所做的操作。所以我决定做一个小实验:

^{pr2}$

输出为:

2691 function calls (2655 primitive calls) in 74.005 seconds
Ordered by: internal time

ncalls  tottime  percall  cumtime  percall filename:lineno(function)
   83   43.819    0.528   43.819    0.528 {method 'acquire' of 'thread.lock' objects}
    1   30.112   30.112   30.112   30.112 {sklearn.svm.libsvm.fit}

我想知道是什么原因造成这种行为。如果有可能的话,能不能加快一点。在


Tags: of机器lock利用objects管道jobsfunction
1条回答
网友
1楼 · 发布于 2024-06-12 20:25:56

探查器只告诉您主进程在做什么,而它的子进程正在做所有的工作。在这种情况下,将verbose=2设置为GridSearchCV可能会提供比%prun更好的输出。在

相关问题 更多 >