-
Notifications
You must be signed in to change notification settings - Fork 7
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
No method matching for NeuroTreeModel #475
Comments
Thanks @abuszydlik, will take a look asap (probably not today though) |
Initial error has been resolved (thanks @pat-alt!), now generation fails with the following stacktrace: ERROR: LoadError: MethodError: no method matching (::NeuroTree{Matrix{Float32}, Vector{Float32}, Array{Float32, 3}, typeof(tanh)})(::Matrix{AbstractFloat})
Closest candidates are:
(::NeuroTree{W, B, P, F})(::W) where {W, B, P, F}
@ NeuroTreeModels [path].julia\packages\NeuroTreeModels\QUDXW\src\model.jl:22
Stacktrace:
[1] (::NeuroTreeModels.StackTree)(x::Matrix{AbstractFloat})
@ NeuroTreeModels [path].julia\packages\NeuroTreeModels\QUDXW\src\model.jl:99
[2] macro expansion
@ [path].julia\packages\Flux\MtsAN\src\layers\basic.jl:53 [inlined]
[3] _applychain(layers::Tuple{BatchNorm{…}, NeuroTreeModels.StackTree}, x::Matrix{AbstractFloat})
@ Flux [path].julia\packages\Flux\MtsAN\src\layers\basic.jl:53
[4] Chain
@ [path].julia\packages\Flux\MtsAN\src\layers\basic.jl:51 [inlined]
[5] (::NeuroTreeModel{NeuroTreeModels.MLogLoss, Chain{Tuple{…}}})(x::Matrix{AbstractFloat})
@ NeuroTreeModels [path].julia\packages\NeuroTreeModels\QUDXW\src\model.jl:137
[6] logits(M::CounterfactualExplanations.Models.Model, type::CounterfactualExplanations.NeuroTreeModel, X::Vector{…})
@ NeuroTreeExt [path].julia\packages\CounterfactualExplanations\VIn4V\ext\NeuroTreeExt\neurotree.jl:87
[7] logits(M::CounterfactualExplanations.Models.Model, X::Vector{AbstractFloat})
@ CounterfactualExplanations.Models [path].julia\packages\CounterfactualExplanations\VIn4V\src\models\core_struct.jl:87
[8] probs(M::CounterfactualExplanations.Models.Model, type::CounterfactualExplanations.NeuroTreeModel, X::Vector{…})
@ NeuroTreeExt [path].julia\packages\CounterfactualExplanations\VIn4V\ext\NeuroTreeExt\neurotree.jl:102
[9] probs(M::CounterfactualExplanations.Models.Model, X::Vector{AbstractFloat})
@ CounterfactualExplanations.Models [path].julia\packages\CounterfactualExplanations\VIn4V\src\models\core_struct.jl:94
[10] counterfactual_probability(ce::CounterfactualExplanation, x::Nothing)
@ CounterfactualExplanations [path].julia\packages\CounterfactualExplanations\VIn4V\src\counterfactuals\info_extraction.jl:51
[11] target_probs(ce::CounterfactualExplanation, x::Nothing)
@ CounterfactualExplanations [path].julia\packages\CounterfactualExplanations\VIn4V\src\counterfactuals\info_extraction.jl:80
[12] threshold_reached(ce::CounterfactualExplanation, x::Nothing)
@ CounterfactualExplanations.Convergence [path].julia\packages\CounterfactualExplanations\VIn4V\src\convergence\decision_threshold.jl:57
[13] converged
@ [path].julia\packages\CounterfactualExplanations\VIn4V\src\convergence\decision_threshold.jl:45 [inlined]
[14]
@ CounterfactualExplanations.Convergence [path].julia\packages\CounterfactualExplanations\VIn4V\src\convergence\decision_threshold.jl:45
[15] terminated(ce::CounterfactualExplanation)
@ CounterfactualExplanations [path].julia\packages\CounterfactualExplanations\VIn4V\src\counterfactuals\termination.jl:7
[16] update!(ce::CounterfactualExplanation)
@ CounterfactualExplanations [path].julia\packages\CounterfactualExplanations\VIn4V\src\counterfactuals\search.jl:23
[17] generate_counterfactual(x::Matrix{…}, target::Int64, data::CounterfactualData, M::CounterfactualExplanations.Models.Model, generator::CounterfactualExplanations.Generators.GradientBasedGenerator; num_counterfactuals::Int64, initialization::Symbol, convergence::CounterfactualExplanations.Convergence.DecisionThresholdConvergence, timeout::Nothing)
@ CounterfactualExplanations [path].julia\packages\CounterfactualExplanations\VIn4V\src\counterfactuals\generate_counterfactual.jl:114
[18] default_logic(current_stage::Recourse, agent::Customer, sim::StandardABM{…})
@ Main [path]Desktop\Agents\src\stages\recourse.jl:22
[19] process
@ [path]Desktop\Agents\src\stages\recourse.jl:8 [inlined]
[20] process(current_stage::Recourse, agent::Customer, sim::StandardABM{…})
@ Main [path]Desktop\Agents\src\stages\recourse.jl:7
[21] welfare_step!(agent::Customer, model::StandardABM{…})
@ Main [path]Desktop\Agents\src\simulation.jl:19
[22] step_ahead!(model::StandardABM{…}, agent_step!::typeof(welfare_step!), model_step!::typeof(dummystep), n::Int64, t::Base.RefValue{…})
@ Agents [path].julia\packages\Agents\MBOEF\src\simulations\step_standard.jl:17
[23] step!
@ [path].julia\packages\Agents\MBOEF\src\simulations\step_standard.jl:5 [inlined]
[24] _run!(model::StandardABM{…}, df_agent::DataFrame, df_model::DataFrame, n::Int64, when::Int64, when_model::Int64, mdata::Nothing, adata::Nothing, obtainer::typeof(identity), dt::Int64, p::ProgressMeter.Progress)
@ Agents [path].julia\packages\Agents\MBOEF\src\simulations\collect.jl:166
[25] run!(model::StandardABM{…}, n::Int64; when::Int64, when_model::Int64, mdata::Nothing, adata::Nothing, obtainer::Function, showprogress::Bool, init::Bool, dt::Float64)
@ Agents [path].julia\packages\Agents\MBOEF\src\simulations\collect.jl:148
[26] run!(model::StandardABM{…}, n::Int64)
@ Agents [path].julia\packages\Agents\MBOEF\src\simulations\collect.jl:100
[27] top-level scope
@ [path]Desktop\Agents\src\simulation.jl:92
in expression starting at [path]Desktop\Agents\src\simulation.jl:92
Some type information was truncated. Use `show(err)` to see complete types. |
Closed by #479 |
Hi @pat-alt! Unfortunately the recent changes cause the error from my initial comment in this thread to reappear. The call to X = X[:, :] |> x -> convert.(eltype(Flux.params(M.fitresult().chain)[1]), x) fails on the first call to Conversely, if the conversion is missing, at some point the method is called on type X = X[:, :]
X = convert(Matrix{Float32}, X)
return M.fitresult(X) If |
I am trying to generate Counterfactual Explanations for a NeuroTreeModel, also trained using
CounterfactualExplanations.jl
. While the model itself seems to work as expected (i.e., it is able to generate predictions for unseen samples with reasonable accuracy), trying to generate an explanation leads toMethodError: no method matching.
Here is the code snippet, fully based on the documentation, that seems to be the direct culprit:
and the corresponding error:
The codebase heavily relies on Agents.jl but as far as I am able to tell, the error is fully independent of this dependency.
The text was updated successfully, but these errors were encountered: