predictions[number] = forests[number].predictProbabilities(features.astype(numpy.float32))
// predict the data with all the forests in parallel
requests = []
for i,f in enumerate(forests):
req = Request(partial(predict_forest, i))
req.submit()requests.append(req)for r in requests:
r.wait()
prediction=numpy.dstack(predictions)
prediction = numpy.average(prediction, axis=2)
prediction = prediction.reshape(*(shape[:-1] + (forests[0].labelCount(),)))
After Change
t2 = time.time()
// predict the data with all the forests in parallel
pool = Pool()
for i,f in enumerate(forests):
req = pool.request(partial(predict_forest, i))
pool.wait()
prediction=numpy.dstack(predictions)
prediction = numpy.average(prediction, axis=2)
prediction.shape = shape[:-1] + (forests[0].labelCount(),)