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

Not passing ... arguments to methods #150

Closed
alanault opened this issue Feb 25, 2019 · 3 comments
Closed

Not passing ... arguments to methods #150

alanault opened this issue Feb 25, 2019 · 3 comments

Comments

@alanault
Copy link

Hi there,

I've written a predict_model class for my somewhat esoteric text model. I'd like to pass arguments to the underlying method using the lime function, but they don't seem to be passing down via ...

Looking at the underlying code, I'm not sure whether they're correctly being passed to the underlying method.

I'm building my explainer as:

explainer <- lime(test, model = model, country = "FR")

where I'd like "FR" to be passed to the underlying method. Although it's present in the explainer object, it doesn't seem to be passed to the method.

Any ideas, or am I fundamentally missing something?

Many thanks
Alan

@alanault
Copy link
Author

A-ha! resolved this.

Looks like I should pass the arguments through the lime::explain function rather than inside the explainer itself.
i.e.

explanation <- lime::explain(x = test_dat,
                             explainer = explainer,
                             country = "FR")

@alanault alanault reopened this Feb 26, 2019
@alanault
Copy link
Author

alanault commented Feb 26, 2019

Actually ... my bad, I was right first time. I had changed the underlying lime code to make this work.

I believe we're missing an ellipsis in the explain.character method.

line 98 misses the ellipsis which is needed to pass through additional arguments. It currently reads:

case_res <- predict_model(x = explainer$model, newdata = permutations_tokenized, type = o_type)

... and I believe it should say:

case_res <- predict_model(x = explainer$model, newdata = permutations_tokenized, type = o_type, ... = ...)

@thomasp85
Copy link
Owner

Passing ellipsis on to the prediction function is not something that has been advertised, though it may be a good idea

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