gbm-developers / gbm

Gradient boosted models (the old gbm package)
Other
51 stars 27 forks source link

single tree dendrogram visualization #73

Closed abrahamroseman closed 8 months ago

abrahamroseman commented 1 year ago

Is there a way to easily extract a dendrogram from a single tree extracted from the model? I believe there is a similar diagram in Jane Elith's paper using BRT.

gregridgeway commented 1 year ago

pretty.gbm.tree() will give you the information you need to create the tree. The gbm package does not draw the tree itself. Check out the help ?pretty.gbm.tree to see how to interpret the output.

I should also add that the individual tree is really not very interesting. It’s just a basis function. It would be like drawing just one of a spline’s basis functions. It’s not really interesting on its own without all the other terms.

Greg

From: abrahamroseman @.> Sent: Wednesday, February 15, 2023 10:24 PM To: gbm-developers/gbm @.> Cc: Subscribed @.***> Subject: [gbm-developers/gbm] single tree dendrogram visualization (Issue #73)

Is there a way to easily extract a dendrogram from a single tree extracted from the model? I believe there is a similar diagram in Jane Elith's paper using BRT.

— Reply to this email directly, view it on GitHub https://github.com/gbm-developers/gbm/issues/73 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ACERTQAGW3DUVTWXKFKVZHDWXWMVJANCNFSM6AAAAAAU5T7WDM . You are receiving this because you are subscribed to this thread.Message ID: @.***>

abrahamroseman commented 1 year ago

I noticed pretty.gbm.tree didn’t seem to produce a decision tree instead some sort of basis function.

I was thinking more of how to write down a single decision tree.

2023年2月16日 下午3:17,Greg Ridgeway @.***> 写道:

pretty.gbm.tree() will give you the information you need to create the tree. The gbm package does not draw the tree itself. Check out the help ?pretty.gbm.tree to see how to interpret the output.

I should also add that the individual tree is really not very interesting. It’s just a basis function. It would be like drawing just one of a spline’s basis functions. It’s not really interesting on its own without all the other terms.

Greg

From: abrahamroseman @.> Sent: Wednesday, February 15, 2023 10:24 PM To: gbm-developers/gbm @.> Cc: Subscribed @.***> Subject: [gbm-developers/gbm] single tree dendrogram visualization (Issue #73)

Is there a way to easily extract a dendrogram from a single tree extracted from the model? I believe there is a similar diagram in Jane Elith's paper using BRT.

— Reply to this email directly, view it on GitHub https://github.com/gbm-developers/gbm/issues/73 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ACERTQAGW3DUVTWXKFKVZHDWXWMVJANCNFSM6AAAAAAU5T7WDM . You are receiving this because you are subscribed to this thread.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/gbm-developers/gbm/issues/73#issuecomment-1433726498, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXBIJKZVIXCUU2HLBUSWRQDWX2KQPANCNFSM6AAAAAAU5T7WDM. You are receiving this because you authored the thread.

gregridgeway commented 1 year ago

It does produce a decision tree. And that decision tree is a basis function. It’s just that pretty.gbm.tree() doesn’t draw a pretty picture of a decision tree. Have a look at ?pretty.gbm.tree so that you can interpret the output so that you can draw the tree based on the output.

From: abrahamroseman @.> Sent: Thursday, February 16, 2023 4:27 PM To: gbm-developers/gbm @.> Cc: Greg Ridgeway @.>; Comment @.> Subject: Re: [gbm-developers/gbm] single tree dendrogram visualization (Issue #73)

I noticed pretty.gbm.tree didn’t seem to produce a decision tree instead some sort of basis function.

I was thinking more of how to write down a single decision tree.

2023年2月16日 下午3:17,Greg Ridgeway @.***> 写道:

pretty.gbm.tree() will give you the information you need to create the tree. The gbm package does not draw the tree itself. Check out the help ?pretty.gbm.tree to see how to interpret the output.

I should also add that the individual tree is really not very interesting. It’s just a basis function. It would be like drawing just one of a spline’s basis functions. It’s not really interesting on its own without all the other terms.

Greg

From: abrahamroseman @.> Sent: Wednesday, February 15, 2023 10:24 PM To: gbm-developers/gbm @.> Cc: Subscribed @.***> Subject: [gbm-developers/gbm] single tree dendrogram visualization (Issue #73)

Is there a way to easily extract a dendrogram from a single tree extracted from the model? I believe there is a similar diagram in Jane Elith's paper using BRT.

— Reply to this email directly, view it on GitHub https://github.com/gbm-developers/gbm/issues/73 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ACERTQAGW3DUVTWXKFKVZHDWXWMVJANCNFSM6AAAAAAU5T7WDM . You are receiving this because you are subscribed to this thread.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/gbm-developers/gbm/issues/73#issuecomment-1433726498, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXBIJKZVIXCUU2HLBUSWRQDWX2KQPANCNFSM6AAAAAAU5T7WDM. You are receiving this because you authored the thread.

— Reply to this email directly, view it on GitHub https://github.com/gbm-developers/gbm/issues/73#issuecomment-1433734910 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ACERTQCIW333LYU2CHT7QRDWX2LRXANCNFSM6AAAAAAU5T7WDM . You are receiving this because you commented.Message ID: @.***>

bgreenwell commented 1 year ago

@abrahamroseman, I’ve come across some solutions in the past; for example, see this post: https://www.justinsingh.me/post/2020-12-04-visualizing-gbm-trees-in-r/

abrahamroseman commented 1 year ago

Thanks. I saw this before but implemented it incorrectly, but now was able to run it correctly.

However, I'm not sure about something when i view the plot. The prediction seems to make decisions based on different values. For example, in the image below it goes one way when less than 153 and another way when great than 0.38, which doesn't quite make sense.

截屏2023-02-19 下午9 38 22