Commit 50d3244f authored by Daniela Rabe's avatar Daniela Rabe
Browse files

update parameter description, replace velox with fasterize in documentation

parent 321adc56
...@@ -11,6 +11,8 @@ ...@@ -11,6 +11,8 @@
#' @param reference reference spectra either SpatialPointsDataFrame (shape file) or data.frame with lines = classes, column = predictors] #' @param reference reference spectra either SpatialPointsDataFrame (shape file) or data.frame with lines = classes, column = predictors]
#' @param model which machine learning classifier to use c("rf", "svm") for random forest or suppurt vector machine implementation #' @param model which machine learning classifier to use c("rf", "svm") for random forest or suppurt vector machine implementation
#' @param mtry number of predictor used at random forest splitting nodes (mtry << n predictors) #' @param mtry number of predictor used at random forest splitting nodes (mtry << n predictors)
#' @param mod.error threshold for model error until which iteration is being executed
#' @param in.memory boolean for raster processing (memory = "TRUE", from disk = "FALSE")
#' @param last only true for one class classifier c("FALSE", TRUE") #' @param last only true for one class classifier c("FALSE", TRUE")
#' @param seed set seed for reproducable results #' @param seed set seed for reproducable results
#' @param init.seed "sample" for new or use run1@seeds to reproduce previous steps #' @param init.seed "sample" for new or use run1@seeds to reproduce previous steps
...@@ -65,7 +67,6 @@ sample_nb <- function(raster, ...@@ -65,7 +67,6 @@ sample_nb <- function(raster,
### ###
l <- 1 ###6. opt=260 l <- 1 ###6. opt=260
pbtn1 <- matrix(1, nrow = 1, ncol = 1) pbtn1 <- matrix(1, nrow = 1, ncol = 1)
pbtn2 <- matrix(2, nrow = 1, ncol = 1)
m <- vector("numeric", length = length(nb_samples)) m <- vector("numeric", length = length(nb_samples))
layer <- list() layer <- list()
for (r in nb_samples) { for (r in nb_samples) {
...@@ -116,7 +117,6 @@ sample_nb <- function(raster, ...@@ -116,7 +117,6 @@ sample_nb <- function(raster,
mtry = mtry, mtry = mtry,
mod.error = mod.error, mod.error = mod.error,
pbtn1 = pbtn1, pbtn1 = pbtn1,
pbtn2 = pbtn2,
rast = rast, rast = rast,
max_samples_per_class = max_samples_per_class, max_samples_per_class = max_samples_per_class,
mc.cores = cores, mc.cores = cores,
...@@ -144,7 +144,6 @@ sample_nb <- function(raster, ...@@ -144,7 +144,6 @@ sample_nb <- function(raster,
mtry = mtry, mtry = mtry,
mod.error = mod.error, mod.error = mod.error,
pbtn1 = pbtn1, pbtn1 = pbtn1,
pbtn2 = pbtn2,
rast = rast, rast = rast,
max_samples_per_class = max_samples_per_class max_samples_per_class = max_samples_per_class
) )
......
...@@ -13,9 +13,9 @@ ...@@ -13,9 +13,9 @@
#' @param n_channel number of channels #' @param n_channel number of channels
#' @param seed2 spatial points sample #' @param seed2 spatial points sample
#' @param mtry number of predictor used at random forest splitting nodes (mtry << n predictors) #' @param mtry number of predictor used at random forest splitting nodes (mtry << n predictors)
#' @param mod.error threshold for model error until which iteration is being executed
#' @param pbtn1 matrix for points #' @param pbtn1 matrix for points
#' @param pbtn2 matrix for points #' @param rast raster
#' @param ras_vx velox raster
#' @param max_samples_per_class maximum number of samples per class #' @param max_samples_per_class maximum number of samples per class
#' #'
#' @return a list with 4 elements: #' @return a list with 4 elements:
...@@ -37,7 +37,6 @@ model_opt_r <- function(k, ...@@ -37,7 +37,6 @@ model_opt_r <- function(k,
mtry, mtry,
mod.error, mod.error,
pbtn1, pbtn1,
pbtn2,
rast, rast,
max_samples_per_class) { max_samples_per_class) {
points <- NULL points <- NULL
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#' @param reference reference spectra as a data.frame with (lines = classes, column = predictors) #' @param reference reference spectra as a data.frame with (lines = classes, column = predictors)
#' @param model which machine learning classifier to use c("rf", "svm") for random forest or support vector machine implementation #' @param model which machine learning classifier to use c("rf", "svm") for random forest or support vector machine implementation
#' @param mtry number of predictor used at random forest splitting nodes (mtry << n predictors) #' @param mtry number of predictor used at random forest splitting nodes (mtry << n predictors)
#' @param mod.error threshold for model error until which iteration is being executed
#' @param last only true for one class classifier c("FALSE", TRUE") #' @param last only true for one class classifier c("FALSE", TRUE")
#' @param seed set seed for reproducible results #' @param seed set seed for reproducible results
#' @param init.seed "sample" for new or use run1@seeds to reproduce previous steps #' @param init.seed "sample" for new or use run1@seeds to reproduce previous steps
...@@ -20,7 +21,8 @@ ...@@ -20,7 +21,8 @@
#' @param n_classes total number of classes (habitat types) to be separated #' @param n_classes total number of classes (habitat types) to be separated
#' @param multiTest number of test runs to compare different probability outputs #' @param multiTest number of test runs to compare different probability outputs
#' @param RGB rgb channel numbers for image plot #' @param RGB rgb channel numbers for image plot
#' @param color color pallet #' @param in.memory boolean for raster processing (memory = "TRUE", from disk = "FALSE")
#' @param color single colors for continuous color palette interpolation
#' @param overwrite overwrite the KML and raster files from previous runs (default TRUE) #' @param overwrite overwrite the KML and raster files from previous runs (default TRUE)
#' @param save_runs an Habitat object is saved into disk for each run (default TRUE) #' @param save_runs an Habitat object is saved into disk for each run (default TRUE)
#' @param parallel_mode run loops using all available cores (default FALSE) #' @param parallel_mode run loops using all available cores (default FALSE)
...@@ -30,7 +32,7 @@ ...@@ -30,7 +32,7 @@
#' @return 4 files per step: #' @return 4 files per step:
#' 1) Habitat type probability map as geocoded *.kmz file (with a *.kml layer and *.png image output), and *.tif raster file #' 1) Habitat type probability map as geocoded *.kmz file (with a *.kml layer and *.png image output), and *.tif raster file
#' 2) A Habitat object (only if save_runs is set to TRUE) consisting of 7 slots: \cr #' 2) A Habitat object (only if save_runs is set to TRUE) consisting of 7 slots: \cr
#' run1@models - list of selcted classifiers \cr #' run1@models - list of selected classifiers \cr
#' run1@ref_samples - list of SpatialPointsDataFrames with same length as run1@models holding reference labels [1,2] for each selected model \cr #' run1@ref_samples - list of SpatialPointsDataFrames with same length as run1@models holding reference labels [1,2] for each selected model \cr
#' run1@switch - vector of lenght run1@models indicating if target class equals 2, if not NA the labels need to be switched \cr #' run1@switch - vector of lenght run1@models indicating if target class equals 2, if not NA the labels need to be switched \cr
#' run1@layer - raster map of habitat type probability \cr #' run1@layer - raster map of habitat type probability \cr
......
...@@ -43,7 +43,7 @@ remotes::install_git( ...@@ -43,7 +43,7 @@ remotes::install_git(
) )
##0.2## ##0.2##
libraries <- c("rgdal","raster","maptools","spatialEco","randomForest","e1071","devtools","velox","rgeos","leaflet","htmlwidgets", "HaSa") libraries <- c("rgdal","raster","maptools","spatialEco","randomForest","e1071","devtools", "fasterize","rgeos","leaflet","htmlwidgets", "HaSa")
lapply(libraries, library, character.only = TRUE) lapply(libraries, library, character.only = TRUE)
......
...@@ -13,9 +13,8 @@ The dependency list is defined in the docker file, `context/hasa.docker` ...@@ -13,9 +13,8 @@ The dependency list is defined in the docker file, `context/hasa.docker`
The image uses the latest version of `R` available for `Ubuntu 20.04`. The image uses the latest version of `R` available for `Ubuntu 20.04`.
### HaSa ### HaSa Dependencies
The `HaSa` R package depends on `velox-v0.2.0`. To install `velox-v0.2.0` it is necessary to pin the version of some R packages: `BH`, `sp`, `sf`, and `rgdal`.
All the dependencies and installation command for `HaSa` are defined in `context/install.R`. All the dependencies and installation command for `HaSa` are defined in `context/install.R`.
## Start a docker container ## Start a docker container
......
...@@ -65,14 +65,7 @@ The point shapefile contains a point location per class and is used to extract t ...@@ -65,14 +65,7 @@ The point shapefile contains a point location per class and is used to extract t
The following procedure will lead you through the preliminary steps required to setup the HaSa tool. The following procedure will lead you through the preliminary steps required to setup the HaSa tool.
## 2.1 HaSa dependencies ## 2.1 HaSa dependencies
HaSa uses the latest version of the `velox` library (`v0.2.0`) which does not compile with the latest version the interface to the C++ Boost library `BH`. Hence, it is necessary to pin the `BH` version. All the dependencies and installation command for `HaSa` are defined in `context/install.R`.
The installation of `BH` is possible with the following commands:
```{r install dependencies, eval = FALSE}
install.packages("remotes")
install.packages("https://cran.r-project.org/src/contrib/Archive/BH/BH_1.69.0-1.tar.
gz", repos = NULL, type = "source")
```
## 2.2 Install HaSa ## 2.2 Install HaSa
HaSa is not yet available as a CRAN package. The user needs to install it directly from its repository. Since versions of certain packages were pinned (c.f., Section 2.1), the user should use `upgrade = FALSE` when calling `remotes::install_git`. In the following example the user can install the `HaSa` R package, build its manual and its vignettes. HaSa is not yet available as a CRAN package. The user needs to install it directly from its repository. Since versions of certain packages were pinned (c.f., Section 2.1), the user should use `upgrade = FALSE` when calling `remotes::install_git`. In the following example the user can install the `HaSa` R package, build its manual and its vignettes.
...@@ -94,7 +87,7 @@ Before the user starts using `HaSa` it is necessary to load the library and some ...@@ -94,7 +87,7 @@ Before the user starts using `HaSa` it is necessary to load the library and some
```{r load libraries, echo = TRUE, results = 'hide', message = FALSE, warning = FALSE} ```{r load libraries, echo = TRUE, results = 'hide', message = FALSE, warning = FALSE}
options("rgdal_show_exportToProj4_warnings" = "none") options("rgdal_show_exportToProj4_warnings" = "none")
libraries <- c("rgdal","raster","maptools","spatialEco","randomForest","e1071", libraries <- c("rgdal","raster","maptools","spatialEco","randomForest","e1071",
"devtools","velox","rgeos","leaflet","htmlwidgets", "IRdisplay", "HaSa") "devtools","fasterize","rgeos","leaflet","htmlwidgets", "IRdisplay", "HaSa")
lapply(libraries, library, character.only = TRUE) lapply(libraries, library, character.only = TRUE)
``` ```
......
...@@ -110,18 +110,7 @@ required to setup the HaSa tool. ...@@ -110,18 +110,7 @@ required to setup the HaSa tool.
## 2.1 HaSa dependencies ## 2.1 HaSa dependencies
HaSa uses the latest version of the `velox` library (`v0.2.0`) which All the dependencies and installation command for `HaSa` are defined in `context/install.R`.
does not compile with the latest version the interface to the C++ Boost
library `BH`. Hence, it is necessary to pin the `BH` version.
The installation of `BH` is possible with the following commands:
``` r
install.packages("remotes")
install.packages("https://cran.r-project.org/src/contrib/Archive/BH/BH_1.69.0-1.tar.
gz",
repos = NULL, type = "source")
```
## 2.2 Install HaSa ## 2.2 Install HaSa
...@@ -149,7 +138,7 @@ warning messages related with the latest changes in `gdal` and `PROJ6`. ...@@ -149,7 +138,7 @@ warning messages related with the latest changes in `gdal` and `PROJ6`.
``` r ``` r
options(rgdal_show_exportToProj4_warnings = "none") options(rgdal_show_exportToProj4_warnings = "none")
libraries <- c("rgdal", "raster", "maptools", "spatialEco", "randomForest", libraries <- c("rgdal", "raster", "maptools", "spatialEco", "randomForest",
"e1071", "devtools", "velox", "rgeos", "leaflet", "htmlwidgets", "IRdisplay", "e1071", "devtools", "fasterize", "rgeos", "leaflet", "htmlwidgets", "IRdisplay",
"HaSa") "HaSa")
lapply(libraries, library, character.only = TRUE) lapply(libraries, library, character.only = TRUE)
``` ```
......
Supports Markdown
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