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

Using a function to define itself? #29

Open
RossKen opened this issue Aug 21, 2018 · 1 comment
Open

Using a function to define itself? #29

RossKen opened this issue Aug 21, 2018 · 1 comment

Comments

@RossKen
Copy link

RossKen commented Aug 21, 2018

I have been trying to figure out what xgboostExplainer does under the hood and came across something strange (to my eyes anyway) when looking at the definition of findLeaves.R.

image

I can't work out:

  1. why findLeaves() is used in the definition of findLeaves() (see line11)
  2. how you can have three parameters of findLeaves() (see line 11) when it only has two by the definition being created. What does the with = FALSE part do?

Any help with either of these queries would be really appreciated!

@areeves87
Copy link

  1. This is called a recursive function. They are useful for searching data structures with a lot of branches, such as a decision tree. There's nothing wrong with this approach although I don't know enough about this stuff to comment whether it could be improved.

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