def _transform(self, X, method):
"""Aux. function to make parallel predictions/transformation."""
self._check_Xy(X)
method = _check_method(self.base_estimator, method)
if X.shape[-1] != len(self.estimators_):
raise ValueError('The number of estimators does not match '
'X.shape[2]')
# For predictions/transforms the parallelization is across the data and
# not across the estimators to avoid memory load.
parallel, p_func, n_jobs = parallel_func(_sl_transform, self.n_jobs)
X_splits = np.array_split(X, n_jobs, axis=-1)
est_splits = np.array_split(self.estimators_, n_jobs)
y_pred = parallel(p_func(est, x, method)
for (est, x) in zip(est_splits, X_splits))
if n_jobs > 1:
y_pred = np.concatenate(y_pred, axis=1)
else:
y_pred = y_pred[0]
return y_pred
search_light.py 文件源码
python
阅读 35
收藏 0
点赞 0
评论 0
评论列表
文章目录