sample_nb.Rd 3.17 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/inner_procedure.r
\name{sample_nb}
\alias{sample_nb}
\title{Perform Habitat Sampling and Probability Mapping}
\usage{
sample_nb(
  raster,
  nb_samples,
  sample_type,
  nb_mean,
  nb_it,
  buffer,
  reference,
  model,
  mtry,
Daniela Rabe's avatar
Daniela Rabe committed
17
  mod.error,
18
19
20
  last,
  seed,
  init.seed,
Daniela Rabe's avatar
Daniela Rabe committed
21
  in.memory,
22
  save_runs,
23
  parallel_mode,
24
  max_num_cores,
25
26
  progress_bar = TRUE,
  session
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
)
}
\arguments{
\item{raster}{satellite time series stack (rasterBrickObject) or just any type of image (*rasterObject)}

\item{nb_samples}{number of spatial locations}

\item{sample_type}{distribution of spatial locations c("random","regular")}

\item{nb_mean}{number of iterations for model accuracy}

\item{buffer}{distance (in m) for new sample collection around initial samples (depends on pixel size)}

\item{reference}{reference spectra either SpatialPointsDataFrame (shape file) or data.frame with lines = classes, column = predictors]}

\item{model}{which machine learning classifier to use c("rf", "svm") for random forest or suppurt vector machine implementation}

\item{mtry}{number of predictor used at random forest splitting nodes (mtry << n predictors)}

Daniela Rabe's avatar
Daniela Rabe committed
46
47
\item{mod.error}{threshold for model error until which iteration is being executed}

48
49
50
51
52
53
\item{last}{only true for one class classifier c("FALSE", TRUE")}

\item{seed}{set seed for reproducable results}

\item{init.seed}{"sample" for new or use run1@seeds to reproduce previous steps}

Daniela Rabe's avatar
Daniela Rabe committed
54
55
\item{in.memory}{boolean for raster processing (memory = "TRUE", from disk = "FALSE")}

56
57
\item{save_runs}{if the user wants to save the runs, if TRUE the complete Habitat Class object is returned}

58
59
60
\item{parallel_mode}{run loops in parallel}

\item{max_num_cores}{maximum number of cores for parallelism}
61

62
63
64
\item{progress_bar}{if true use a normal progress bar, otherwise a shiny progress bar}

\item{session}{shiny session, needed for progress bar update}
65

66
67
68
\item{nb_models}{number of models (independent classifiers) to collect}
}
\value{
69
a list with 5 elements:
70
\enumerate{
71
\item returns 0 succeeded, 1 increase init.samples, or 2 increase init.samples and nb_models
72
\item An index
73
\item num_models number of models selected
74
75
\item Accuracy vector
\item A vector with a Habitat objects, each consisting of 7 slots: \cr
76
77
78
run1@models - list of selected classifiers (only if save_runs is TRUE) \cr
run1@ref_samples - list of SpatialPointsDataFrames with same length as run1@models holding reference labels \link{1,2} for each selected model (only if save_runs is TRUE) \cr
run1@switch - vector of length run1@models indicating if target class equals 2, if not NA the labels need to be switched (only if save_runs is TRUE) \cr
79
run1@layer - raster map of habitat type probability \cr
80
81
82
run1@mod_all - list of all classifiers (equals nb_models) (only if save_runs is TRUE) \cr
run1@class_ind - vector of predictive distance measure for all habitats (only if save_runs is TRUE) \cr
run1@seeds - vector of seeds for random sampling (only if save_runs is TRUE) \cr
83
84
85
86
87
88
89
all files are saved with step number, the *.tif file is additionally saved with class names
}
}
\description{
This is the function that performs: initiate sampling and model building
}
\keyword{internal}