0

I have built a M5 model tree using the train function of the caret package. I am trying to extract the linear model coefficients for each model of the tree.

The final model is called m5tune. I tried to look into m5tune$finalModel but I did not find it. The coeff() function does not seem to work either...

jmuhlenkamp
  • 2,102
  • 1
  • 14
  • 37
lbo34
  • 41
  • 1
  • Dear [Ibo34](https://stackoverflow.com/users/9851830/lbo34), welcome to SO. Please take a look at [How to make a great R reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example), to modify your question, with a smaller sample taken from your data (check?dput()). Posting images of your data or no data makes it difficult to impossible for us to help you! – massisenergy Dec 18 '18 at 15:17
  • I had a look in `finalModel` and could not find the regression coefficients readily available. The object that seems to hold them is `finalModel$classifier` but this is only a handle (`jobref`) for a java object... – asachet Dec 18 '18 at 15:44
  • What I am trying to do is to plot the linear model coefficients for each node of the tree. finalModel displays the coefficients on the screen, but I did not find a way to extract them in a data table for instance to plot them. – lbo34 Dec 19 '18 at 19:02

0 Answers0