Learn R Programming

fdcov (version 1.1.0)

classifier-com: Functional data classifier via concentration inequalities

Description

classif.com trains a covariance operator based functional data classifier that makes use of concentration inequalities. predict.classif.com uses the previously trained classifier to classify new observations.

Usage

classif.com(datGrp, dat)

# S3 method for classif.com predict(object, dat, SOFT = FALSE, LOADING = FALSE, ...)

Arguments

datGrp

A vector of group labels.

dat

(n X m) data matrix of n samples of m long vectors.

object

A concentration-of-measure classifier object of class inheriting from classif.com.

SOFT

Boolean flag, which if TRUE, returns soft classification for each observation.

LOADING

Boolean flag, which if TRUE, prints a loading bar.

...

additional arguments affecting the predictions produced.

Value

classif.com returns a functional data classifier object. predict.classif.com returns a vector of n labels ( or an array of n probability vectors if SOFT=TRUE )

Details

These functions are used to train a functional data classifier and to predict the labels for a new set of observations. This method classifies based on the distances between each groups' sample covariance operator. A simplified version of Talagrand's concentration inequality is used to achieve this.

If the flag SOFT is set to TRUE, then soft classification occurs. In this case, given k different labels, a k-long probability vector is returned for each observation whose entries correspond to the probabilities that the observed function belongs to each specific label.

References

Kashlak, Adam B, John AD Aston, and Richard Nickl (2016). "Inference on covariance operators via concentration inequalities: k-sample tests, classification, and clustering via Rademacher complexities", (in review)

Examples

Run this code
# NOT RUN {
 library(fds);
 # Setup training data
 dat1 = rbind( 
   t(aa$y[,1:100]), t(ao$y[,1:100]), t(dcl$y[,1:100]), 
   t(iy$y[,1:100]), t(sh$y[,1:100]) 
 );
 # Setup testing data
 dat2 = rbind( 
   t(aa$y[,101:400]), t(ao$y[,101:400]), t(dcl$y[,101:400]), 
   t(iy$y[,101:400]), t(sh$y[,101:400]) 
 );
 
 datgrp = gl(5,100);
 clCom = classif.com( datgrp, dat1 );
 grp = predict( clCom, dat2, LOADING=TRUE );
 acc = c(
   sum( grp[1:300]==1 ), sum( grp[301:600]==2 ), sum( grp[601:900]==3 ), 
   sum( grp[901:1200]==4 ), sum( grp[1201:1500]==5 )
 )/300;
 print(rbind(gl(5,1),signif(acc,3)));
# }

Run the code above in your browser using DataLab