Encodemethod
Jump to navigation
Jump to search
Purpose
Create a cross-validation index vector for a given method..
Synopsis
- cvi = encodemethod(items,method,n,blocksize)
Output (cvi) is a vector containing the group number of each item.
Description
Inputs
- items = number of items to sort into sets [e.g., size(x,1) for x a data array].
- method = string defining the cross-validation method defined below.
- n = number of subsets to split the data into
- blocksize = number of items to include in each block (NOTE: blocksize for 'vet' method only)
The input parameter method 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 "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.
Examples
cvi = encodemethod(20,'con',4); cvi = encodemethod(20,'vet',5,2);