Search code examples
pythonmatplotlibplotscikit-learnensemble-learning

plot_partial_dependence in sklearn not showing


I wrote down the code like suggested in their examples but the following code does not show anything.

result=ensemble.GradientBoostingRegressor(n_estimators=2000,learning_rate=0.08,max_depth=4,min_samples_leaf=25,subsample=0.5,loss='huber')
result = result.fit(train_vars,train['d'])
features = ['a','b','c']
fig,axs = plot_partial_dependence(result, train_vars, features,feature_names=features, n_cols=2)
fig.show()

What am I doing wrong?


Solution

  • I just had to do plt.show(), it seems the figure gets embedded to matplotlib's main grid.