Kerry Back
from sklearn.ensemble import RandomForestRegressor Xtrain = df[df.date=='2021-12'][features] ytrain = df[df.date=='2021-12']["ret"] model = RandomForestRegressor( max_depth=3, random_state=0 ) model.fit(Xtrain, ytrain)
from sklearn.ensemble import GradientBoostingRegressor model = GradientBoostingRegressor( max_depth=3, learning_rate=0.05, random_state=0 ) model.fit(Xtrain, ytrain)
from sklearn.tree import DecisionTreeRegressor from sklearn.ensemble import AdaBoostRegressor model = AdaBoostRegressor( DecisionTreeRegressor( max_depth=3, random_state=0 ), learning_rate=0.5, ) model.fit(Xtrain, ytrain)