Shuffle: Difference between revisions

From Eigenvector Research Documentation Wiki
Jump to navigation Jump to search
imported>Jeremy
(Importing text file)
imported>Jeremy
No edit summary
Line 1: Line 1:
===Purpose===
===Purpose===


Line 12: Line 11:
===Description===
===Description===


SHUFFLE randomly re-orders the rows of the input matrix x and returns the results as xr.
This function shuffles samples (rows) in a matrix (e.g. so that they can be used randomly for cross-validations.) If more than one input is provided, all additional inputs (''x2'','' x3'', ...) must have same number of rows as x, and will have their rows re-ordered to the same random order as xr.  


All additional inputs (''x2'','' x3'', ...) must have same number of rows as x, and will have their rows re-ordered to the same random order as xr. If the final input is the string groups then the first input is sorted into groups of matching rows and the order of the groups is randomly shuffled, keeping group members together. This is useful for random reordering of measurement replicates. If all the rows of the first input are unique, groups will have no effect on the behavior of shuffle.
If the final input is the string groups then the first input is sorted into groups of matching rows and the order of the groups is randomly shuffled, keeping group members together. This is useful for random reordering of measurement replicates. If all the rows of the first input are unique, groups will have no effect on the behavior of shuffle.


===See Also===
===See Also===


[[delsamps]]
[[delsamps]]

Revision as of 13:23, 7 October 2008

Purpose

Randomly re-order matrix rows.

Synopsis

xr = shuffle(x)
[xr,x2r,x3r,x4r...] = shuffle(x,x2,x3,x4...)
[xr,x2r,x3r,...] = shuffle(x,x2,x3,...,'groups')

Description

This function shuffles samples (rows) in a matrix (e.g. so that they can be used randomly for cross-validations.) If more than one input is provided, all additional inputs (x2, x3, ...) must have same number of rows as x, and will have their rows re-ordered to the same random order as xr.

If the final input is the string groups then the first input is sorted into groups of matching rows and the order of the groups is randomly shuffled, keeping group members together. This is useful for random reordering of measurement replicates. If all the rows of the first input are unique, groups will have no effect on the behavior of shuffle.

See Also

delsamps