Cvifromclass
Jump to navigation
Jump to search
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
- method: a string defining the cross-validation method defined below, can be any of the following:
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)};