PLS_Toolbox Documentation: class2logical | < choosencomp | cluster > |
class2logical
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.
Inputs are class a list of class assignments, or a dataset with classes for first mode, and groups an optional input containing 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 (see e.g. 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
(A) 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])
(B) 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
< choosencomp | cluster > |