【发布时间】:2020-03-12 16:41:19
【问题描述】:
有一个优化问题,我必须调用随机森林回归器的预测函数数千次。
from sklearn.ensemble import RandomForestRegressor
rfr = RandomForestRegressor(n_estimators=10)
rfr = rfr.fit(X, Y)
for iteration in range(0, 100000):
# code that adapts the input data according to fitness of the last output
output_data = rfr.predict(input_data)
# code that evaluates the fitness of output data
在这种情况下,有没有办法提高预测函数的速度?可能通过使用 Cython?
【问题讨论】:
标签: python scikit-learn sklearn-pandas