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

[R-package] use as.factor() instead of factor() in lgb.cv() #3560

Merged
merged 10 commits into from
Nov 29, 2020

Conversation

jameslamb
Copy link
Collaborator

In lgb.cv() in the R package, we use factor() in some places to to create an R factor from the passed-in labels. This helps with creating folds correctly.

This PR proposes removing factor() with as.factor(). as.factor() is faster in some situations. Particularly, it won't do any work if the thing passed into it is already a factor.

From ?factor

as.factor coerces its argument to a factor. It is an abbreviated (sometimes faster) form of factor.

This reverts commit fabaf9a.
@jameslamb jameslamb removed the request for review from StrikerRUS November 17, 2020 22:56
@StrikerRUS StrikerRUS merged commit 97ece14 into microsoft:master Nov 29, 2020
@jameslamb jameslamb deleted the misc/cv-folds branch November 29, 2020 20:33
@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity since it was closed. To start a new related discussion, open a new issue at https://github.com/microsoft/LightGBM/issues including a reference to this.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants