Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Bentriou Mahmoud
MarkovProcesses.jl
Commits
190833bb
Commit
190833bb
authored
Feb 17, 2021
by
Bentriou Mahmoud
Browse files
small fix in abc when eps is infinity
parent
8c673bae
Changes
1
Hide whitespace changes
Inline
Side-by-side
algorithms/abc_smc.jl
View file @
190833bb
...
...
@@ -177,8 +177,7 @@ function _abc_smc(pm::ParametricModel, nbr_particles::Int, tolerance::Float64, a
old_epsilon
=
epsilon
end
mat_p
=
mat_p_old
mat_cov
=
cov
(
mat_p
,
ProbabilityWeights
(
wl_old
),
2
;
corrected
=
false
)
mat_cov
=
cov
(
mat_p_old
,
ProbabilityWeights
(
wl_old
),
2
;
corrected
=
false
)
if
dir_results
!=
nothing
writedlm
(
dir_results
*
"weights_end.csv"
,
wl_old
,
','
)
writedlm
(
dir_results
*
"mat_p_end.csv"
,
mat_p_old
,
','
)
...
...
@@ -191,7 +190,7 @@ function _abc_smc(pm::ParametricModel, nbr_particles::Int, tolerance::Float64, a
write
(
file_cfg
,
"Number of threads:
$
(Threads.nthreads())
\n
"
)
close
(
file_cfg
)
end
r
=
ResultAbc
(
mat_p
,
mat_cov
,
nbr_tot_sim
,
time
()
-
begin_time
,
vec_dist
,
epsilon
,
wl_old
,
l_ess
)
r
=
ResultAbc
(
mat_p
_old
,
mat_cov
,
nbr_tot_sim
,
time
()
-
begin_time
,
vec_dist
,
old_
epsilon
,
wl_old
,
l_ess
)
return
r
end
...
...
@@ -285,12 +284,12 @@ function _distributed_abc_smc(pm::ParametricModel, nbr_particles::Int, tolerance
flush
(
stdout
)
old_epsilon
=
epsilon
end
mat_cov
=
cov
(
mat_p
,
ProbabilityWeights
(
wl_old
),
2
;
corrected
=
false
)
mat_cov
=
cov
(
mat_p
_old
,
ProbabilityWeights
(
wl_old
),
2
;
corrected
=
false
)
save_mat_p_end
=
true
if
dir_results
!=
nothing
writedlm
(
dir_results
*
"weights_end.csv"
,
wl_
current
,
','
)
writedlm
(
dir_results
*
"mat_p_end.csv"
,
mat_p
,
','
)
writedlm
(
dir_results
*
"weights_end.csv"
,
wl_
old
,
','
)
writedlm
(
dir_results
*
"mat_p_end.csv"
,
mat_p
_old
,
','
)
file_cfg
=
open
(
dir_results
*
"results_abc.out"
,
"w"
)
write
(
file_cfg
,
"
\n
"
)
write
(
file_cfg
,
"About the results:
\n
"
)
...
...
@@ -300,7 +299,7 @@ function _distributed_abc_smc(pm::ParametricModel, nbr_particles::Int, tolerance
write
(
file_cfg
,
"Number of threads:
$
(Threads.nthreads())
\n
"
)
close
(
file_cfg
)
end
r
=
ResultAbc
(
mat_p
,
mat_cov
,
nbr_tot_sim
,
time
()
-
begin_time
,
convert
(
Array
,
d_vec_dist
),
epsilon
,
wl_
current
,
l_ess
)
r
=
ResultAbc
(
mat_p
_old
,
mat_cov
,
nbr_tot_sim
,
time
()
-
begin_time
,
convert
(
Array
,
d_vec_dist
),
old_
epsilon
,
wl_
old
,
l_ess
)
return
r
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment