cerlymarco / linear-tree

A python library to build Model Trees with Linear Models at the leaves.
MIT License
338 stars 54 forks source link

Have precision of threshold be customizable #35

Closed dawidjaja closed 1 year ago

dawidjaja commented 1 year ago

Currently, we hard code the precision of threshold as 5 in here. Having this customizable will allow us to use the linear tree model when the number that are used are smaller in general. My suggestion is have another parameter that defaults to 5 and when people wants to use the model with smaller number, they could do it by set this parameter to the number they desired.

Let me know if this change is good and I could create a PR for it. I'm open for discussion.

cerlymarco commented 1 year ago

Hi, the code reference you are pointing out is for "visualization" purposes. In other words, when you call the summary or model_to_dot methods the threshold values are rounded to 5 digits. This does not influence the training behavior as you see (here, here and here). If u support the project, don't forget to leave a star ;-)

dawidjaja commented 1 year ago

Hi @cerlymarco, I'm trying to get the tree details (threshold, loss, children) and use it elsewhere. it seems that I shouldn't use self._nodes directly as it seems that you intend it to be a private member. How about adding another API to return the _nodes so that there's a way to get these information with complete precision?

dawidjaja commented 1 year ago

@cerlymarco hello, is there any solution for this?

cerlymarco commented 1 year ago

@dawidjaja

self._nodes is not a private method

image