在 Rasbperry Pi 3 上运行 Python 时,我在多处理池中使用 train_test_split 遇到了一些奇怪的行为。我有这样的事情:def evaluate_Classifier(model,Features,Labels,split_ratio): X_train, X_val, y_train, y_val = train_test_split(Features,Labels,test_size=split_ratio)...iterations=500pool = multiprocessing.Pool(4)results = [pool.apply_async(evaluate_Classifier, args=(w,Current_Features,Current_Labels,0.35)) for i in range(iterations)]output = [p.get() for p in results]pool.close()pool.join()现在上面的代码在 Windows 7 Python 3.5.6 上完美运行,实际上 4 个线程中的每一个都会有不同的训练/测试分割。但是,当我在 Raspberry Pi 3 (scikit-learn 0.19.2) 上运行它时,似乎 4 个线程以完全相同的方式拆分数据,因此所有线程产生完全相同的结果。接下来的 4 个线程将再次拆分数据(这次不同),但它们之间的方式仍然完全相同,依此类推....我什至尝试使用带有 random_state=np.random.randint 的 train_test_split,但它没有帮助。任何想法为什么这在 Windows 中有效,但在 raspberry Pi 3 上似乎不能正确并行化?
添加回答
举报
0/150
提交
取消
