View source: R/SOptim_GridSearch.R
searchOptimSegmentationParams | R Documentation |
This function performs the optimization of segmentation parameters using a simple grid or random search algorithm. It also verifies if input data and parameters are parsable.
searchOptimSegmentationParams(
rstFeatures,
trainData,
segmentMethod,
...,
optimMethod = "random",
segmParamList,
grid.searchSize = 5,
rand.numIter = 250,
rand.nneigh = 5,
rand.initNeighs = (5 * rand.nneigh),
rand.neighSizeProp = 0.025,
rand.iter = 25,
trainThresh = 0.5,
segmStatsFuns = c("mean", "sd"),
classificationMethod = "RF",
classificationMethodParams = NULL,
balanceTrainData = FALSE,
balanceMethod = "ubUnder",
evalMethod = "5FCV",
trainPerc = 0.8,
nRounds = 20,
evalMetric = "Kappa",
minTrainCases = 30,
minCasesByClassTrain = 10,
minCasesByClassTest = 10,
minImgSegm = 30,
verbose = TRUE,
parallel = FALSE,
seed = NULL
)
rstFeatures |
Features used for supervised classification (typically a multi-layer SpatRaster with one feature
per band). May be defined as a string with the path to a raster dataset or a |
trainData |
Input train data used for supervised classification. It must be a |
segmentMethod |
Character string used to define the segmentation method. Available options are:
|
... |
Additional parameters passed to the segmentation functions that will not be optimized (see also:
|
optimMethod |
A string defining which type of optimizing to use. Options are: |
segmParamList |
A named list object containing the parameters that will be optimized for the selected
segmentation method. Check parameter names with function segmentationParamNames. The list should contain two values
with parameter ranges (min, max). For example, considering method |
grid.searchSize |
This value will be used to extend parameter ranges. For example, if |
rand.numIter |
Number of iteration for random search optimization (default: 250). |
rand.nneigh |
Number of neighbors (or parameter combinations) to generate in the vicinity of the best (default: 5). |
rand.initNeighs |
Number of parameter combinations to randomly draw from paramList at initialization (default: 5 * nneigh) |
rand.neighSizeProp |
Size of the neighbourhood for a given parameter, i.e., a real value contained
in ]0, 1] used to multiply the range size as:
|
rand.iter |
Number of sucessive iterations used to stop the algorithm if no improvement is found (default: 25). |
trainThresh |
A threshold value defining the minimum proportion of the segment ]0, 1] that must be covered
by a certain class to be considered as a training case. This threshold will only apply if |
segmStatsFuns |
An aggregation function (e.g., |
classificationMethod |
An input string defining the classification algorithm to be used. Available options are:
|
classificationMethodParams |
A list object with a customized set of parameters to be used for the classification algorithms (default = NULL). See also generateDefaultClassifierParams to see which parameters can be changed and how to structure the list object. |
balanceTrainData |
Defines if data balancing is to be used (only available for single-class problems; default: TRUE). |
balanceMethod |
A character string used to set the data balancing method. Available methods are based on under-sampling
|
evalMethod |
A character string defining the evaluation method. The available methods are |
trainPerc |
A decimal number defining the training proportion (default: 0.8; if |
nRounds |
Number of training rounds used for holdout cross-validation (default: 20; if |
evalMetric |
A character string setting the evaluation metric or a function that calculates the performance score
based on two vectors one for observed and the other for predicted values (see below for more details).
This option defines the outcome value of the genetic algorithm fitness function and the output of grid or random search
optimization routines. Check |
minTrainCases |
The minimum number of training cases used for calibration (default: 20). If the number of rows
in |
minCasesByClassTrain |
Minimum number of cases by class for each train data split so that the classifier is able to run. |
minCasesByClassTest |
Minimum number of cases by class for each test data split so that the classifier is able to run. |
minImgSegm |
Minimum number of image segments/objects necessary to generate train data. |
verbose |
Print output messages? (default: TRUE). |
parallel |
A logical argument specifying if parallel computing should be used (TRUE) or not (FALSE, default) for evaluating the fitness function. This argument could also be used to specify the number of cores to employ; by default, this is taken from detectCores. Finally, the functionality of parallelization depends on system OS: on Windows only 'snow' type functionality is available, while on Unix/Linux/Mac OSX both 'snow' and 'multicore' (default) functionalities are available. |
seed |
An integer value containing the random number generator state. This argument can be used to replicate the results of a grid search. Note that if parallel computing is required, the doRNG package must be installed |
A data frame containing the segmentation parameters tested and the respective value of the evaluation metric (by default the table is ordered in decreasing order using this column).
Check the segmentation parameters and data used by each algorithm that must be defined in ...
and
segmParamList
:
segmentationGeneric
,
SAGA Seeded Region Growing: segmentation_SAGA_SRG
,
GRASS Region Growing: segmentation_GRASS_RG
,
ArcGIS Mean Shift: segmentation_ArcGIS_MShift
,
TerraLib Baatz-Schaphe: segmentation_Terralib_Baatz
,
Terralib Mean Region Growing: segmentation_Terralib_MRGrow
,
RSGISLib Shepherd: segmentation_RSGISLib_Shep
,
RSGISLib OTB Large Scale Mean Shift: segmentation_OTB_LSMS
segmentationParamNames can be used to output a short list of parameter names to include in segmParamList
for
optimization.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.