Skip to contents

Implements the Hall & Bathia (2012) algorithm for selecting a subset of points from functional data (e.g., wavelet coefficients or contours) that optimize classification accuracy.

Usage

select_points_hall(
  data,
  grouping,
  method = "lda",
  cv = TRUE,
  p = 0.01,
  delta_t = 0.01,
  mean_error = "mgroups",
  parallel = FALSE
)

Arguments

data

An object of class fdata or a matrix where each row is an observation.

grouping

A factor specifying the class labels for each observation.

method

Classification method to use. One of "lda", "qda", "NaiveBayes", "logistic", "knn", "svm".

cv

Logical. If TRUE, use cross-validation to estimate error.

p

Numeric. Stopping criterion. Stop when improvement is less than p * error.

delta_t

Numeric. Minimum distance between selected points (as a fraction of total points).

mean_error

Metric for error. Either "mtotal" (overall error) or "mgroups" (mean error per group).

parallel

Logical. If TRUE, use parallel processing (supported on Windows via parLapply or Unix via mclapply).

Value

A list containing:

  • selected_indices: Indices of the selected points.

  • error_path: Vector of error rates at each iteration.

  • confusion_matrix: Final confusion matrix using cross-validation.

Examples

if (FALSE) { # \dontrun{
# Example usage with dummy data
library(fda.usc)
data(phoneme)
res <- select_points_hall(phoneme$data[1:100, ], phoneme$class[1:100], method = "lda")
} # }