How to get coefficients of gradient boosting models? I tried gradient boosting models using both gbm in R and sklearn in Python. However, neither of them can provide the coefficients of the model. For gbm in R, it seems one can get the tree structure, but I can't find a way to get the coefficients. For sklearn in Python, I can't even see the tree structure, not to mention the coefficients. Can anyone give me some help? 
After searching online for couple of hours, I still can't find the answer. I can find similar questions since 2009, but no answers. Like the followings:


*

*GBM package: Extract coefficients  (r-help thread)

*Implementing Gradient Boosted Regression Trees in production - Mathemtically describing the learnt model (SO thread)
This make me wonder if R and Python are mainly used by academic people, and thus majority of the users don't care about how to use them in industry. For example, if you want to implement the results in some real-time platform which doesn't run Python, what would you do?
 A: I use R "in industry".  GBM's and other tree-based methods don't have "coefficients" so it's pointless to try to extract them.
What you CAN do is encode each tree as a SQL query.  It take a little effort, but once you can do it for a single tree, you can loop over all the trees in a model, generate ~500 SQL queries, and use them to score your model on a database of your choosing.
A: Like Zach mentioned earlier, "coefficients" don't really apply for a GBM. I'm not sure how you're implementing it, but in a package like CARET (for R) you can look at variable importance during model building. You can also see something similar in the vignette for the GBM package in R. In the GBM package, I think it is called relative influence; the maths behind it is in the 2001 paper by Friedman.
Both of those approaches would go some way to giving you a ranking of how "useful"/"important" your variables were in classifying the target using a GBM.
A: Use PMML to transfer the model to other platforms, assuming your other platform is PMML-compatible. 
A: For python, you could use import _pickle as cPickle to save the model to a pickle file and restore the model from the pickle file. 
The codes for store the model:
with open("gbmFit.pkl", "wb") as pickle_file:
    cPickle.dump(model, pickle_file)

For restore the model, one could use following code:
with open('gbmFit.pkl', 'rb') as pickle_file:
    gbmfit = cPickle.load(pickle_file)
    y_pred_restore = gbmfit.predict(np.array(x1 + 1).reshape((-1, 1)))

Now you could save the model and save it for later real time use.
