Open mehwish2021 opened 4 days ago
Hi! Please use the github version of the shapr package.
Thanks for your prompt response Martinju.
A little more clarification, do you mean I have to add these functions in the code of shapR package?? Can you please guide in which file I need to add these functions ?
I would really appreciate you response
No, the package on CRAN is outdated (and will be replaced by the main at GitHub) soon. It does things a bit differently. I suggest you install the github version of shapr instead, modify your code accordingly, try to use that to explain your custom model instead. The procedure is explained her: https://norskregnesentral.github.io/shapr/articles/understanding_shapr.html#explain-custom-models (which is slightly different from the procedure with the version on CRAN)
If you still got issues after that, let me know.
Hello All, I have a Keras model, is it possible to make it work with it?
Hello All, I have a Keras model, is it possible to make it work with it?
Yes. Please see the main vignetten on the pkgdown site for instructions.
Thanks. I tried and that works well on model I built with the Boston Dataset. However with one of my real model I get this
`explanation <- explain( model = finalModel, x_explain = sdt.test, x_train = dt.test[1:100, ], approach = "empirical", # Choose explanation approach phi0 = phi0, # Specify baseline value predict_model = predict_model.EnsembleModel, get_model_specs = get_model_specs,
verbose = "progress" )
Success with message: max_n_coalitions is NULL or larger than or 2^n_features = 3.86856262276681e+25, and is therefore set to 2^n_features = 3.86856262276681e+25.
Error in .makeMessage(..., domain = domain) : argument is missing, with no default`
I am trying to understand this error by looking on the source code I still don't understand. Any suggest about where I should investigate.? PS: I use the version from the main of this github repo.
It seems you have an enormous number of features? (83 or 84 features?)
I have not seen this error message before, but in any case, you should first try to reduce the number of features to see if it works then. Also, set max_n_coalitions to 500 or something to reduce runtime when testing.
Yes, excellent. But I've dug into the code a little bit to have like a traceback of my error.
I think apart from the big number of features. my error is coming from the warning
in the code. Especially for me . In the explain function, we call setup
and in the function check_computability
my input leads me to this condition:
if (isFALSE(is_groupwise) && n_features > 30) { warning( "Due to computation time, we strongly recommend enabling iterative estimation with iterative = TRUE", " when n_features > 30.\n", ) }
However a warning written this way produce an error because of the "," at the end. You can reproduce my error just by calling this line :
warning( "Due to computation time, we strongly recommend enabling iterative estimation with iterative = TRUE", " when n_features > 30.\n", )
Oh, thanks a lot for catching that bug! I will fix it ASAP
@vmombo I just merged the fix to main
thank you very much. I have just seen your comment
Hello All, I am using DeepCC model in which I want to apply SHAPR to get the shaply values . I defined the functions as described in here https://cran.r-project.org/web/packages/shapr/vignettes/understanding_shapr.html , but its still giving me the error that SHAPR is not defined for this model.
I have defined these functions get_model_specs() and predict_model() as mentioned in the vignette but I am confused how and where are those functions called? Please help as it has taken much time and I am unable to resolve this issue