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

Fixed handling of categorical features. #20

Merged
merged 3 commits into from
May 15, 2023
Merged

Fixed handling of categorical features. #20

merged 3 commits into from
May 15, 2023

Conversation

Tialo
Copy link
Contributor

@Tialo Tialo commented May 5, 2023

Closes #18, closes #19

I described my changes here.
Leshy changes.pdf

I would be glad if you would take a look at my changes. Those will fix mentioned issues. If you want me to change anything feel free to say, thanks.

@ThomasBury ThomasBury self-assigned this May 15, 2023
@ThomasBury ThomasBury added the bug Something isn't working label May 15, 2023
@@ -337,18 +337,15 @@ def _fit(self, X_raw, y, sample_weight=None):
# because the columns are dynamically created/rejected
X = X_raw

X = np.nan_to_num(X)
y = np.nan_to_num(y)
X = X.apply(np.nan_to_num)
Copy link
Owner

Choose a reason for hiding this comment

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

good catch, I, wrongly, kept the boruta initial version. This will indeed mess up the data types. I will probably change it to X.fillna(0) and y.fillna(0) rather than apply (slow) and nan_to_num (numpy, while pandas methods are more suited).

X = X.apply(np.nan_to_num)
if not isinstance(y, pd.Series):
y = pd.Series(np.nan_to_num(y))
else:
Copy link
Owner

Choose a reason for hiding this comment

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

same, I'd use y.fillna(0)

@ThomasBury ThomasBury merged commit fbd355b into ThomasBury:main May 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants