#2415 Fix precision issue in tree split descriptions#2721
#2415 Fix precision issue in tree split descriptions#2721Shashank1202 wants to merge 1 commit intocatboost:masterfrom
Conversation
|
Hey can anyone guide me where to add test cases, I went through the document , but couldn't make it. Your guidance would be highly appreciated!!! |
There was a problem hiding this comment.
The create_dir_if_not_exist function could be improved to handle exceptions more efficiently, such as when a directory already exists to avoid a race condition in multi-threaded environments. You could use os.makedirs() with exist_ok=True (Python 3.2+) to avoid manual checks.
def create_dir_if_not_exist(path):
os.makedirs(path, exist_ok=True)
| return True | ||
|
|
||
| ### Function to add full Precision split | ||
| def get_full_precision_splits(self, tree_idx, pool= None): |
There was a problem hiding this comment.
The new function get_full_precision_splits is defined as a standalone function in core.py, but it tries to access self._object. Since it's not a method of a class, self will be undefined, causing a NameError when the function is called. Functions operating on the model object should typically be methods within the CatBoost class (or its base class) to have access to self.
Possibly just an indentation issue
|
Just a note. The PR description mentions creating a method named |
andrey-khropov
left a comment
There was a problem hiding this comment.
It won't work like this because _get_tree_splits returns already prepared strings.
The function that generates these descriptions is implemented in C++ and called here.
I suggest adding an additional parameter to it (add up in the call stack in python package functions) that specifies the format for printing floating point values. I suggest to use a well-known printf notation.

get_full_precision_tree_splitsincore.pyto retrieve tree split descriptions with 8 significant digits.This change addresses issue #2415, improving the precision of split descriptions in tree visualizations.