Class2logical

From Eigenvector Documentation Wiki

Jump to: navigation, search

Contents

Purpose

Create a PLSDA logical block from class assignments.

Synopsis

[y,nonzero] = class2logical(class,groups)

Description

Given a list of sample classes or a DataSet object with class assignments for samples (mode 1), CLASS2LOGICAL creates a logical array in which each column of (y) contains the logical class membership (i.e. 1 or 0) for each class. This logical block can be used as the input (y) in PLS or PCR to perform discriminate analysis. Similarly, the output can be used with CROSSVAL to perform PLSDA cross-validation. Classes can optionally be grouped together by providing class groupings.

The input (class) is a list of class assignments for each sample/row, or a dataset with classes for first mode. Optional input (groups) contains either:

[1 2 3 ...] a vector of classes to model OR
{[1 2] [3 4] ...} a cell array containing groups of classes to consider as one class. Each cell element will be one class (e.g., see below)

Any classes in (class) which are not listed in (groups) are considered part of no group and will be assigned zero for all columns in the output.

Outputs are (y) a logical array in which each column represents one of the classes in the input class list or one of the groups in groups and nonzero the indices of samples with non-zero class assignment.

Examples

Given DataSet "arch" with classes 0-5, the following creates a logical block with two columns consisting of "true" only for class 3 in the first column and "true" only for class 2 in the second column.

y = class2logical(arch,[3 2])

Given DataSet "arch" with classes 0-5, the following creates a logical block with two columns consisting of "true" only for classes 0 and 1 in the first column and "true" only for classes 2 and 4 in the second column.

y = class2logical(arch,{[1 0] [2 4]})


See Also

crossval, plsda, plsdthres

Views
Personal tools