I am new to scikit-learn and random forest regression and wondered if there is an easy way to get predictions from each tree in a random forest in addition to combined prediction. I would like to display all the predictions in the list and not look at the whole tree. I know that I can get sheet indexes using the apply method, but I'm not sure how to use this to get the value from the sheet. Any help is appreciated.
Edit: this is what I have left from the comments below. It was not clear to me that the trees in the valuators_ attribute could be called, but it seems that the forecasting method can be used on each tree using this attribute. Is this the best way to do this?
numberTrees = 100 clf = RandomForestRegressor(n_estimators=numberTrees) clf.fit(X,Y) for tree in range(numberTrees): print(clf.estimators_[tree].predict(val.irow(1)))
python scikit-learn regression random-forest
chunky
source share