Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Habitat Sampler
HabitatSampler
Commits
ec8c492e
Commit
ec8c492e
authored
Aug 05, 2021
by
Daniela Rabe
Browse files
Merge branch 'progressbar' into 'master'
update Progressbar See merge request
!27
parents
d7702099
673218ee
Pipeline
#26237
passed with stages
in 7 minutes and 42 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
R-package/R/inner_procedure.r
View file @
ec8c492e
...
...
@@ -19,7 +19,8 @@
#' @param save_runs if the user wants to save the runs, if TRUE the complete Habitat Class object is returned
#' @param parallel_mode run loops in parallel
#' @param max_num_cores maximum number of cores for parallelism
#' @param progress_bar if true use a normal progress bar, otherwise a shiny's progress bar
#' @param progress_bar if true use a normal progress bar, otherwise a shiny progress bar
#' @param session shiny session, needed for progress bar update
#'
#' @return a list with 5 elements:
#' 1) returns 0 succeeded, 1 increase init.samples, or 2 increase init.samples and nb_models
...
...
@@ -57,7 +58,8 @@ sample_nb <- function(raster,
save_runs
,
parallel_mode
,
max_num_cores
,
progress_bar
=
TRUE
)
{
progress_bar
=
TRUE
,
session
)
{
print
(
paste
(
paste
(
"init.samples = "
,
nb_samples
[
1
]),
paste
(
"models = "
,
nb_mean
)))
###
...
...
@@ -153,9 +155,12 @@ sample_nb <- function(raster,
if
(
progress_bar
)
{
setTxtProgressBar
(
pb
,
k
)
}
else
{
shinybusy
::
update_modal_progress
(
value
=
k
/
(
nb_mean
+
nrow
(
reference
)),
text
=
paste
(
"Doing sampling for model"
,
k
)
shinyWidgets
::
updateProgressBar
(
session
=
session
,
id
=
"pbar"
,
value
=
k
,
total
=
nb_mean
,
title
=
paste
(
"Doing sampling for model"
,
k
)
)
}
}
...
...
@@ -226,10 +231,13 @@ sample_nb <- function(raster,
}
m
[
l
]
<-
max
(
dif
[
2
,],
na.rm
=
T
)
if
(
!
progress_bar
)
{
shinybusy
::
update_modal_progress
(
value
=
(
nb_mean
+
jj
)
/
(
nb_mean
+
nrow
(
reference
)),
text
=
paste
(
"Doing prediction for class"
,
jj
)
)
shinyWidgets
::
updateProgressBar
(
session
=
session
,
id
=
"pbar"
,
value
=
jj
,
total
=
nrow
(
reference
),
title
=
paste
(
"Doing prediction for class"
,
jj
)
)
}
}
index
<-
which.max
(
dif
[
2
,])
...
...
R-package/man/sample_nb.Rd
View file @
ec8c492e
...
...
@@ -22,7 +22,8 @@ sample_nb(
save_runs,
parallel_mode,
max_num_cores,
progress_bar = TRUE
progress_bar = TRUE,
session
)
}
\arguments{
...
...
@@ -58,7 +59,9 @@ sample_nb(
\item{max_num_cores}{maximum number of cores for parallelism}
\item{progress_bar}{if true use a normal progress bar, otherwise a shiny's progress bar}
\item{progress_bar}{if true use a normal progress bar, otherwise a shiny progress bar}
\item{session}{shiny session, needed for progress bar update}
\item{nb_models}{number of models (independent classifiers) to collect}
}
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment