Commit 7ccf6160 authored by Bentriou Mahmoud's avatar Bentriou Mahmoud

change doc of abc methods

parent 715f269f
......@@ -23,10 +23,10 @@ function getproperty(dataset::AbcModelChoiceDataset, sym::Symbol)
end
"""
`abc_model_choice_dataset(models, models_prior,
summary_stats_observations,
summary_stats_func::Function, distance_func::Function,
k::Int, N_ref::Int; dir_results::Union{Nothing,String} = nothing)`
abc_model_choice_dataset(models, models_prior,
summary_stats_observations,
summary_stats_func::Function, distance_func::Function,
k::Int, N_ref::Int; dir_results::Union{Nothing,String} = nothing)
Creates a reference table for ABC model choice.
......@@ -56,10 +56,10 @@ function abc_model_choice_dataset(models::Vector{<:Union{Model,ParametricModel}}
end
"""
`abc_model_choice_dataset(models, models_prior,
summary_stats_observations,
summary_stats_func::Function, distance_func::Function,
k::Int, N_ref::Int; dir_results::Union{Nothing,String} = nothing)`
abc_model_choice_dataset(models,
summary_stats_observations,
summary_stats_func::Function, distance_func::Function,
k::Int, N_ref::Int; dir_results::Union{Nothing,String} = nothing)
Creates a reference table for ABC model choice with discrete uniform prior distribution over the models.
"""
......@@ -161,10 +161,10 @@ function _distributed_abc_model_choice_dataset(models::Vector{<:Union{Model,Para
end
"""
`rf_abc_model_choice(models, summary_stats_observations,
summary_stats_func::Function, N_ref::Int;
k::Int = N_ref, distance_func::Function = (x,y) -> 1,
hyperparameters_range::Dict)`
rf_abc_model_choice(models, summary_stats_observations,
summary_stats_func::Function, N_ref::Int;
k::Int = N_ref, distance_func::Function = (x,y) -> 1,
hyperparameters_range::Dict)
Run the Random Forest Approximate Bayesian Computation model choice method.
......@@ -179,8 +179,8 @@ The optional arguments are:
* `k`: the k nearest samples from the observations to keep in the reference table (by default: k = N_ref)
* `distance_func`: the distance function, has to be defined if k < N_ref
* `hyperparameters_range`: a dict with the hyperparameters range values for the cross validation
fit of the Random Forest (by default: `Dict(:n_estimators => [200], :min_samples_leaf => [1], :min_samples_split => [2])`).
See scikit-learn documentation of RandomForestClassifier for the hyperparameters name.
fit of the Random Forest (by default: `Dict(:n_estimators => [200], :min_samples_leaf => [1], :min_samples_split => [2])`).
See scikit-learn documentation of RandomForestClassifier for the hyperparameters name.
The result is a `RandomForestABC` object with fields:
* `reference_table` an AbcModelChoiceDataset that corresponds to the reference table of the algorithm,
......@@ -205,11 +205,10 @@ function rf_abc_model_choice(models::Vector{<:Union{Model,ParametricModel}},
end
"""
`posterior_proba_model(rf_abc::RandomForestABC)`
posterior_proba_model(rf_abc::RandomForestABC)
Estimates the posterior probability of the model with the Random Forest ABC method.
Estimates the posterior probability of the model ``P(M = \\widehat{M}(s_{obs}) | s_{obs})`` with the Random Forest ABC method.
"""
# P(m = m^(ss_obs) | ss_obs) estimate
function posterior_proba_model(rf_abc::RandomForestABC)
oob_votes = rf_abc.clf.oob_decision_function_
y_pred_oob = argmax.([oob_votes[i,:] for i = 1:size(oob_votes)[1]])
......
......@@ -24,6 +24,12 @@ struct ResultAbc
weights::Vector{Float64}
l_ess::Vector{Float64}
end
"""
automaton_abc(pm::ParametricModel, l_obs, func_dist; nbr_particles, alpha, kernel_type, NT
duration_time, bound_sim, sym_var_aut, verbose)
Run the Automaton-ABC-SMC algorithm with the pm parametric model. `pm.m` has to be a `SynchronizedModel`.
"""
function automaton_abc(pm::ParametricModel;
nbr_particles::Int = 100, tolerance::Float64 = 0.0, alpha::Float64 = 0.75, kernel_type = "mvnormal",
......@@ -57,18 +63,19 @@ function automaton_abc(pm::ParametricModel;
end
"""
`abc_smc(pm::ParametricModel, l_obs, func_dist; nbr_particles, alpha, kernel_type, NT
duration_tiùe, bound_sim, sym_var_aut, verbose)`
abc_smc(pm::ParametricModel, l_obs, func_dist; nbr_particles, alpha, kernel_type, NT
duration_time, bound_sim, sym_var_aut, verbose)
Run the ABC-SMC algorithm with the pm parametric model.
`func_dist(l_sim, l_obs)` is the distance function between simulations and observation,
it corresponds to \$\rho(\eta(y_sim), \eta(y_exp))\$.
it corresponds to ``\\rho(\\eta(y_sim), \\eta(y_exp))\\``.
`l_obs::Vector{<:T2}` is a collection of observations.
`dist` must have a signature of the form `func_dist(l_sim::Vector{T1}, l_obs::Vector{T2})`.
If pm is defined on a ContinuousTimeModel, then `T1` should verify `T1 <: Trajectory`.
!!! Distance function and distributed ABC
If `pm` is defined on a `ContinuousTimeModel`, then `T1` should verify `T1 <: Trajectory`.
!!! Distance function and distributed ABC
If you use `abc_smc` with multiple workers, `dist` has to be defined
on every workers by using @everywhere.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment