python3.4 connection.py bytes对象不可调用

时间:2014-12-02 19:26:40

标签: python multiprocessing scikit-learn

我正在使用来自scikit-learn的LogisticRegression和RandomizedSearchCV,而我的python版本是3.4。
但是,代码在多处理期间抛出TypeError:

Fitting 5 folds for each of 10 candidates, totalling 50 fits
[Parallel(n_jobs=8)]: Done   1 jobs       | elapsed:    1.2s
Process ForkPoolWorker-718:
Traceback (most recent call last):
  File "/usr/lib/python3.4/multiprocessing/process.py", line 254, in _bootstrap
    self.run()
  File "/usr/lib/python3.4/multiprocessing/process.py", line 93, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/lib/python3.4/multiprocessing/pool.py", line 108, in worker
    task = get()
  File "/usr/local/lib/python3.4/dist-packages/sklearn/externals/joblib/pool.py", line 343, in get
    return recv()
  File "/usr/lib/python3.4/multiprocessing/connection.py", line 251, in recv
    return ForkingPickler.loads(buf.getbuffer())
TypeError: 'bytes' object is not callable

以下是使用随机搜索(使用多处理)

的参数优化代码
print("Performing parameter optimization ...")
params = \
{'penalty': ['l1', 'l2'],
'C': [0.001, 0.01, 0.1, 1.0, 10, 100, 1000, 10000, 100000],
'dual': [False],
'class_weight': ['auto']}

search = RandomizedSearchCV(estimator, params,
                                        n_iter=10,
                                        scoring=scorer, n_jobs=8, refit=True,
                                        cv=StratifiedKFold(y_trains, 5), 
                                        verbose=1, random_state=1)

search.fit(X_trains, y_trains)

对问题是什么以及如何解决问题有所了解?

0 个答案:

没有答案