Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How is the value to split at chosen? #41

Closed
ZmeiGorynych opened this issue May 14, 2024 · 2 comments
Closed

How is the value to split at chosen? #41

ZmeiGorynych opened this issue May 14, 2024 · 2 comments

Comments

@ZmeiGorynych
Copy link

Hi, let's say you're considering to split a node along a certain float-valued dimension. How do you choose the candidate split values (that is, the value to which you compare the column values to decide if they end up in the right or left subtree)?
To choose among the candidates, you compare the error values - but how do you choose the candidates themselves?

@cerlymarco
Copy link
Owner

Hi, the candidate splits are chosen extracting quantiles from each feature distribution:

# extract quantiles
bins = np.linspace(0, 1, self.max_bins)[1:-1]
bins = np.quantile(X, bins, axis=0)
bins = list(bins.T)
bins = [np.unique(X[:, c]) if c in self._categorical_features
else np.unique(q) for c, q in enumerate(bins)]

If u support the project don't forget to leave a star ;-)
all the best

@ZmeiGorynych
Copy link
Author

Perfect, thanks a lot!
I'm not using linear-tree directly right now, but am doing something very similar here, so just wanted to compare methodologies :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants