Class2logical: Difference between revisions

From Eigenvector Research Documentation Wiki
Jump to navigation Jump to search
imported>Jeremy
imported>Jeremy
 
Line 5: Line 5:
===Synopsis===
===Synopsis===


:[y,nonzero] = class2logical(class,''groups'')
:[y,nonzero] = class2logical(cls,''groups'',''classset'')


===Description===
===Description===

Latest revision as of 10:55, 22 February 2013

Purpose

Create a PLSDA logical block from class assignments.

Synopsis

[y,nonzero] = class2logical(cls,groups,classset)

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

  • cls = a list of class assignments or a dataset with classes assigned for the first mode
  • groups = an optional input containing either:
    [] a vector of classes to model such as [1 2 3 4] OR
    {[] []...} a cell array containing groups of classes to consider as one class such as {[1 2] [3 4]}. Each cell element will be one class (see e.g. below). Any classes in (cls) which are not listed in (groups) are considered part of no group and will be assigned zero for all columns in the output.

Optional Inputs

  • classset = when input (cls) is a dataset, classset specifies which class set from (cls) should be used as classes. This defaults to class set 1. An error will occur if the specified class does not exist.

Outputs

  • y = a DataSet containing a logical array in which each column represents one of the classes in the input class list or one of the groups in (groups).
  • nonzero = the indices of samples with non-zero class assignment. Note: if class zero is explictly referenced in the (groups) input, then nonzero will include all samples.

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