Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
MarkovProcesses.jl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Bentriou Mahmoud
MarkovProcesses.jl
Commits
7ccf6160
Commit
7ccf6160
authored
3 years ago
by
Bentriou Mahmoud
Browse files
Options
Downloads
Patches
Plain Diff
change doc of abc methods
parent
715f269f
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
algorithms/abc_model_choice.jl
+16
-17
16 additions, 17 deletions
algorithms/abc_model_choice.jl
algorithms/abc_smc.jl
+12
-5
12 additions, 5 deletions
algorithms/abc_smc.jl
with
28 additions
and
22 deletions
algorithms/abc_model_choice.jl
+
16
−
17
View file @
7ccf6160
...
...
@@ -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
]])
...
...
This diff is collapsed.
Click to expand it.
algorithms/abc_smc.jl
+
12
−
5
View file @
7ccf6160
...
...
@@ -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_ti
m
e, 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 \
$
\r
ho(\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.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment