From bf1501579e0662768963b24e6880698822dcb6ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Poisot?= Date: Fri, 20 Dec 2024 10:11:44 -0500 Subject: [PATCH] perf(demo): avoid some GC but not all --- SDeMo/src/explanations/shapley.jl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/SDeMo/src/explanations/shapley.jl b/SDeMo/src/explanations/shapley.jl index 1b3bcd1fb..1c39a4801 100644 --- a/SDeMo/src/explanations/shapley.jl +++ b/SDeMo/src/explanations/shapley.jl @@ -69,7 +69,9 @@ function explain( samples = 200, kwargs..., ) where {T <: AbstractSDM} - predictor = (x) -> predict(model, x; kwargs...) + function predictor(x) + return predict(model, x; kwargs...) + end instances = isnothing(instances) ? features(model) : instances if isnothing(observation) return shap_all_points(predictor, instances, features(model), j, samples)