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

Implement basic feature sampling in tree model #212

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

RAMitchell
Copy link
Contributor

Implements #202

@RAMitchell RAMitchell changed the title [WIP] Implement basic feature sampling in tree model Implement basic feature sampling in tree model Feb 14, 2025
@RAMitchell RAMitchell marked this pull request as ready for review February 14, 2025 15:09
Copy link
Contributor

@seberg seberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, with some tiny comments.

I have some questions about feature-fraction behavior/sampling, we can hash out offline (and as soon as that it is clear, this is good.).

feature_fraction :
If float, the subsampled fraction of features considered in building this model.
Users may implement an arbitrary function returning a cupynumeric array of
booleans of shape `(n_features,)` to specify the feature subset.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
booleans of shape `(n_features,)` to specify the feature subset.
booleans of shape ``(n_features,)`` to specify the feature subset.

Should we say how this is rounded?

@@ -33,6 +33,10 @@ class Tree(BaseModel):
split_samples : int
The number of data points to sample for each split decision.
Max value is 2048 due to constraints on shared memory in GPU kernels.
feature_fraction :
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like you wanted to put this. (I'll note that since we do have type hints in think it is also completely fine to just put nothing/remove the : even.)

@@ -57,6 +61,7 @@ def __init__(
*,
max_depth: int = 8,
split_samples: int = 256,
feature_fraction: Union[float, Callable[..., cn.array]] = 1.0,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
feature_fraction: Union[float, Callable[..., cn.array]] = 1.0,
feature_fraction: Union[float, Callable[[], cn.array]] = 1.0,

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

Successfully merging this pull request may close these issues.

2 participants