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

[Blocking] Fix #3840: Clean up logic for parsing tree_method parameter #3849

Merged
merged 11 commits into from
Nov 2, 2018

Conversation

hcho3
Copy link
Collaborator

@hcho3 hcho3 commented Nov 1, 2018

Try to consolidate logic concerning tree_method and updater into one place. Also use C++11 enum class for tree_method for extra safety. (For instance, compilers will generate warning if a switch statement doesn't handle all possible values of an enum class. This makes our code future-proof, in case someone decides to add another tree method.)

Closes #3840.

hcho3 added 2 commits October 31, 2018 16:53
Compiler will give warnings if switch statements don't handle all
possible values of C++11 enum class.

Also allow enum class to be used as DMLC parameter.
@hcho3
Copy link
Collaborator Author

hcho3 commented Nov 1, 2018

@Laurae2 This should fix the issue with selecting correct tree_method.

@hcho3 hcho3 force-pushed the tree_method_selection branch from 3165c9b to ba924a4 Compare November 1, 2018 03:23
src/learner.cc Outdated Show resolved Hide resolved
src/common/enum_class_param.h Show resolved Hide resolved
src/learner.cc Outdated Show resolved Hide resolved
src/learner.cc Show resolved Hide resolved
@hcho3 hcho3 changed the title Fix #3840: Clean up logic for parsing tree_method parameter [Blocking] Fix #3840: Clean up logic for parsing tree_method parameter Nov 1, 2018
@codecov-io
Copy link

codecov-io commented Nov 1, 2018

Codecov Report

Merging #3849 into master will increase coverage by 0.27%.
The diff coverage is 57.35%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #3849      +/-   ##
============================================
+ Coverage     51.85%   52.13%   +0.27%     
  Complexity      203      203              
============================================
  Files           181      183       +2     
  Lines         14360    14453      +93     
  Branches        495      495              
============================================
+ Hits           7447     7535      +88     
- Misses         6675     6680       +5     
  Partials        238      238
Impacted Files Coverage Δ Complexity Δ
tests/cpp/test_learner.cc 100% <100%> (ø) 0 <0> (ø) ⬇️
tests/cpp/test_learner.h 100% <100%> (ø) 0 <0> (?)
tests/cpp/common/test_enum_class_param.cc 100% <100%> (ø) 0 <0> (?)
src/learner.cc 29.09% <31.76%> (-1.04%) 0 <0> (ø)
python-package/xgboost/compat.py 90.9% <0%> (+1.81%) 0% <0%> (ø) ⬇️
python-package/xgboost/core.py 82.23% <0%> (+4.44%) 0% <0%> (ø) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 42200ec...647d41a. Read the comment docs.

@trivialfis
Copy link
Member

@hcho3 Hi, I'm a little bit confused by the configuration logic, does linear models require configuration?

Another thing, updaters for linear model are gpu_coord_descent, coord_descent and shotgun. which should be configured but configuring updater is marked as dangerous action.

@hcho3
Copy link
Collaborator Author

hcho3 commented Nov 8, 2018

@trivialfis Yes it was my oversight. The warning shouldn't have been displayed for gblinear.

alois-bissuel pushed a commit to criteo-forks/xgboost that referenced this pull request Dec 4, 2018
…meter (dmlc#3849)

* Clean up logic for converting tree_method to updater sequence

* Use C++11 enum class for extra safety

Compiler will give warnings if switch statements don't handle all
possible values of C++11 enum class.

Also allow enum class to be used as DMLC parameter.

* Fix compiler error + lint

* Address reviewer comment

* Better docstring for DECLARE_FIELD_ENUM_CLASS

* Fix lint

* Add C++ test to see if tree_method is recognized

* Fix clang-tidy error

* Add test_learner.h to R package

* Update comments

* Fix lint error
@lock lock bot locked as resolved and limited conversation to collaborators Feb 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants