小编Fer*_*yev的帖子

Sklearn 预处理 -- *** TypeError: 找不到匹配的签名

我正在尝试标准化 CSR 矩阵,

但我收到此错误: (*** TypeError: No matching signature found).

from sklearn.preprocessing import normalize
normalize(x_m, norm="l2", axis=1)
Run Code Online (Sandbox Code Playgroud)

该矩阵是 609186x849632 类型为 'numpy.float16' 的稀疏矩阵,其中包含 189140200 个以压缩稀疏行格式存储的元素

python numpy normalize scikit-learn

1
推荐指数
1
解决办法
2945
查看次数

如何始终并行运行 n 个进程,而不等待前 n 个进程完成?

我有 50 种不同的方法想要运行。我有 10 个可用的 cpu,所以我只能同时运行 10 个进程。所以我运行了 5 次。然而,问题是前 10 个进程必须完成才能启动后 10 个进程,这会增加完成所需的时间。我想要的是,一旦 9 个进程运行,一个新进程就应该启动并始终运行 10 个进程。

我将 50 个班级分成 5 个不同的小组并运行。

group1 = [class1, class2...] group2 = [class11, class12..]

组 = [组 1, 组 2, ..., 组 5]

for group in groups:

    threads = []

        for x in group:
            threads.append(mp.Process(target= x().method(), args= (b,)))

        for thread in threads:
            thread.start()

        for thread in threads:
            thread.join()
Run Code Online (Sandbox Code Playgroud)

python parallel-processing multiprocessing python-3.x

1
推荐指数
1
解决办法
699
查看次数