Cvifromclass: Difference between revisions

From Eigenvector Research Documentation Wiki
Jump to navigation Jump to search
 
(2 intermediate revisions by the same user not shown)
Line 7: Line 7:
: cvi = cvifromclass(dso,classset,cvinfo)
: cvi = cvifromclass(dso,classset,cvinfo)
: cvi = cvifromclass(dso,1,{'loo'}) using Leave-One out cross-val
: cvi = cvifromclass(dso,1,{'loo'}) using Leave-One out cross-val
: cvi = cvifromclass(dso,1,{'vet 5 2'}) using venetian blinds cross-val
: cvi = cvifromclass(dso,1,{'vet 5 1'}) using venetian blinds cross-val
: cvi = cvifromclass(dso,1,{'con 2'}) using contiguous blocks cross-val
: cvi = cvifromclass(dso,1,{'con 2'}) using contiguous blocks cross-val
: cvi = cvifromclass(dso,1,{'rnd 2'}) using random cross-val
: cvi = cvifromclass(dso,1,{'rnd 2'}) using random cross-val
Line 31: Line 31:
**n: the number of subsets to split the data into,  
**n: the number of subsets to split the data into,  
**blocksize: the number of items to include in each block  (NOTE: blocksize for 'vet' method only)
**blocksize: the number of items to include in each block  (NOTE: blocksize for 'vet' method only)
***Currently this can only be set to 1


====Outputs====
====Outputs====
Line 41: Line 42:
load arch
load arch
cvi = cvifromclass(arch,1,{'con' 4});
cvi = cvifromclass(arch,1,{'con' 4});
cvi = cvifromclass(arch,1,{'vet' 5 2)};
cvi = cvifromclass(arch,1,{'vet' 5 1)};
</pre>
</pre>



Latest revision as of 09:08, 30 November 2023

Purpose

Create a cross-validation index vector for a given method and class set

Synopsis

cvi = cvifromclass(dso,classset,cvinfo)
cvi = cvifromclass(dso,1,{'loo'}) using Leave-One out cross-val
cvi = cvifromclass(dso,1,{'vet 5 1'}) using venetian blinds cross-val
cvi = cvifromclass(dso,1,{'con 2'}) using contiguous blocks cross-val
cvi = cvifromclass(dso,1,{'rnd 2'}) using random cross-val

Output (cvi) is a vector containing the group number of each item.

Description

Create a cross-validation index vector for given class set in a Dataset Object and a given cross-val method.

Inputs

  • dso = DataSet Object with class information
  • classset = class set to use or vector of numerical class assignments
  • cvinfo = cross-validation information, a cell array which should contain:
    • method: a string defining the cross-validation method defined below, can be any of the following:
      • 'vet'  : Venetian blinds. Every n-th item is grouped together. Optionally allows grouping of more than one sample together using the "blocksize" input.
      • 'con'  : Contiguous blocks. Consecutive items are put into n groups.
      • 'loo'  : Leave one out. Each item is in an individual group, input (n) can be omitted.
      • 'rnd'  : Random. items are randomly split into n equal sized groups.
    • n: the number of subsets to split the data into,
    • blocksize: the number of items to include in each block (NOTE: blocksize for 'vet' method only)
      • Currently this can only be set to 1

Outputs

  • outputs = vector of integer values giving the group number of each item.

Examples

load arch
cvi = cvifromclass(arch,1,{'con' 4});
cvi = cvifromclass(arch,1,{'vet' 5 1)};

See Also

crossval, stratifiedcvi