Calculate features using density-based clustering algorithms
densityBasedFeatures.Rd
The feature_densityBased_all
function calculates all of the density-based
features in one call. Calculate each feature individually using the
feature_densityBased_thetaDiff
, feature_densityBased_translationDiff
, and
feature_densityBased_clusterSize
functions. The densityBasedClusters
and
estimatedRotation
functions are exported helpers.
Usage
feature_densityBased_all(
comparisonData_cellBased,
eps,
minPts,
method = "dbscan",
id_cols = NULL
)
feature_densityBased_thetaDiff(estimatedThetas, direction, imputeVal = NA)
feature_densityBased_translationDiff(x, y, cluster, direction, imputeVal = NA)
feature_densityBased_clusterSize(cluster, direction, imputeVal = NA)
densityBasedClusters(x, y, eps, minPts, method = "dbscan")
estimatedRotation(x, y, theta)
Arguments
- comparisonData_cellBased
tibble such as one returned by the
comparison_cellBased()
function that contains results from the cell-based comparison procedure- eps
a double representing the neighborhood radius used in the DBSCAN algorithm
- minPts
an integer representing the minimum neighborhood size used in the DBSCAN algorithm
- method
a character vector that specifies the algorithm used to find clusters. Must be either "dbscan" or "hdbscan" or "optics" - see the dbscan package for more information.
- id_cols
column names in the comparisonData tibble that uniquely identify each observation. These are returned along with the computed features
- direction
tibble column containing characters "reference_vs_target" or "target_vs_reference" that specify the comparison direction associated with the observation
- imputeVal
value to return if the feature calculation results in a non-numeric (i.e., NA, NULL) value
- x
tibble column containing estimated horizontal translations
- y
tibble column containing estimated vertical translations
- theta
tibble column containing estimated rotations
Note
The eps and minPts arguments are used differently depending on the
method specified. The eps argument is passed to the eps parameter in the
dbscan::dbscan()
function if method == "dbscan" and to the eps_cl
parameter in the dbscan::extractDBSCAN()
function if method == "optics"
Examples
data("K013sA1","K013sA2")
compData <- comparison_cellBased(reference = K013sA1,
target = K013sA2,
thetas = c(-3,0,3))
#> Error in mutate(., direction = "reference_vs_target"): could not find function "mutate"
# calculate all density-based features in one call
feature_densityBased_all(compData,eps = 5,minPts = 5)
#> Error in dplyr::group_by(., direction): object 'compData' not found
# verify that we can calculate the same features using the individual
# feature_densityBased_* functions
compData %>%
dplyr::group_by(direction) %>%
dplyr::filter(theta == estimatedRotation(x = x,y = y,theta = theta)) %>%
dplyr::mutate(clust = densityBasedClusters(x = x,y = y,eps = 5,minPts = 5)) %>%
dplyr::ungroup() %>%
dplyr::summarise(thetaDiff = feature_densityBased_thetaDiff(estimatedThetas = theta,direction = direction),
translationDiff = feature_densityBased_translationDiff(x = x,y = y,cluster = clust,direction = direction),
clusterSize = feature_densityBased_clusterSize(cluster = clust,direction = direction))
#> Error in dplyr::group_by(., direction): object 'compData' not found