gettestandtrainingsampledf: Creates Random Rasters of Traces of a Specific Class.

Description Usage Arguments Value Source References See Also Examples

View source: R/gettestandtrainingsampledf.R

Description

gettestandtrainingsampledf creates one data.frame object for a set of test and training samples that can be used in combination with tunedagsvm in order to tune a support vector machine (SVM) in order to classify values into classes. For each class, there must exist a an individual image file in a separate directory without any other files. NULL values must have the rgb values c(255,255,255), i.e. filled with white color. It is possible to subsample the provided samples and to merge classes.

Usage

1
2
gettestandtrainingsampledf(directorydata, classes, subsamplesize = NULL,
  classestomerge = NULL)

Arguments

directorydata

A character string representing the directory where the image files of the test and training samples are stored. No other files must be in this directory.

classes

A character vector with the class labels to use for each class. The order has to match the order of the files when assessed via list.files. The number of elements of classes has to match the number of files in directorydata.

subsamplesize

A numeric vector with the sizes of the subsamples to collect for each class. The order has to match the order in classes. The number of elements of subsamplesize has to match the number of files in directorydata. The order has to match the order of the files when assessed via list.files. Alternatively, subsamplesize can be set to NULL if no subsampling should be performed.

classestomerge

A list with a vector for each merge of two classes. Each vector must be a character vector with two elements correspnding to two elements of classes. The first element represents the class label to retain whereas the class label of elements correspnding to the second element will be changed into the first element of the vector.

Value

The function returns a data.frame object with four columns:

r

The values of the red band of the test and training samples.

g

The values of the greeb band of the test and training samples.

b

The values of the blue band of the test and training samples.

b

The corresponding class labels as factor.

Source

The function relies on the R packages raster (\insertCiteHijmans.2017TraceIdentification).

References

\insertAllCited

See Also

tunedagsvm.

Examples

1
#

henningte/TraceIdentification documentation built on May 26, 2019, 6:50 p.m.