calcStatsFinish: Ancillary function used in getTrainData_ for final processing...

View source: R/SOptim_GetTrainData.R

calcStatsFinishR Documentation

Ancillary function used in getTrainData_ for final processing (by tile)

Description

Performs data aggregation ops necessary to calculate the percentage cover per class and segment ID based on initial processing by calcStatsStart.

Usage

calcStatsFinish(x, thresh = 0.5)

Arguments

x

A data.frame from calcStatsStart.

thresh

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 x is a SpatRaster which means you are using train areas/pixels. If you are running a "single-class" problem then this threshold only applies to the class of interest (coded as 1's). Considering this, if a given segment has a proportion cover of that class higher than thresh then it is considered a train case. In contrast, for the background class (coded as 0's), only segments/objects totaly covered by that class are considered as train cases. If you are running a "multi-class" problem then thresh is applied differently. First, the train class is determined by a majority rule then if that class covers more than the value specified in thresh this case is kept in train data otherwise it will be filtered out. See also useThresh.

Value

A data.frame with final training data.


joaofgoncalves/SegOptim documentation built on Feb. 5, 2024, 11:10 p.m.