Predict: Function which generates feature weights, discriminant...

Description Usage Arguments Details Value References Examples

Description

Returns a (m x 1) vector of predicted group membership (either 1 or 2) for each data point in X. Uses Data and Cat to train the classifier.

Usage

1
2
Predict(X = NULL, Data, Cat, Sigma = NULL, Gamma = NULL, Lambda = NULL,
  Epsilon = 1e-05)

Arguments

X

(m x p) Matrix of unlabelled data with numeric features to be classified. Cannot have missing values.

Data

(n x p) Matrix of training data with numeric features. Cannot have missing values.

Cat

(n x 1) Vector of class membership corresponding to Data. Values must be either 1 or 2.

Sigma

Scalar Gaussian kernel parameter. Default set to NULL and is automatically generated if user-specified value not provided. Must be > 0. User-specified parameters must satisfy hierarchical ordering.

Gamma

Scalar ridge parameter used in kernel optimal scoring. Default set to NULL and is automatically generated if user-specified value not provided. Must be > 0. User-specified parameters must satisfy hierarchical ordering.

Lambda

Scalar sparsity parameter on weight vector. Default set to NULL and is automatically generated by the function if user-specified value not provided. Must be >= 0. When Lambda = 0, SparseKOS defaults to kernel optimal scoring of [Lapanowski and Gaynanova, preprint] without sparse feature selection. User-specified parameters must satisfy hierarchical ordering.

Epsilon

Numerical stability constant with default value 1e-05. Must be > 0 and is typically chosen to be small.

Details

Function which handles classification. Generates feature weight vector and discriminant coefficients vector in sparse kernel optimal scoring. If a matrix X is provided, the function classifies each data point using the generated feature weight vector and discriminant vector. Will use user-supplied parameters Sigma, Gamma, and Lambda if any are given. If any are missing, the function will run SelectParams to generate the other parameters. User-specified values must satisfy hierarchical ordering.

Value

A list of

Predictions

(m x 1) Vector of predicted class labels for the data points in Data. Only included in non-null value of X is provided.

Weights

(p x 1) Vector of feature weights.

Dvec

(n x 1) Discrimiant coefficients vector.

References

Lapanowski, Alexander F., and Gaynanova, Irina. “Sparse feature selection in kernel discriminant analysis via optimal scoring”, preprint.

Examples

1
2
3
4
5
6
7
8
9
Sigma <- 1.325386  #Set parameter values equal to result of SelectParam.
Gamma <- 0.07531579 #Speeds up example.
Lambda <- 0.002855275
Predict(X = Data$TestData , 
         Data = Data$TrainData , 
         Cat = Data$CatTrain , 
         Sigma = Sigma , 
         Gamma = Gamma , 
         Lambda = Lambda)

aflapan/sparseKOS documentation built on May 3, 2019, 5:23 p.m.