Operations on Datasets

Many standard Matlab operations are overloaded for variables of the dataset type. Usually they just affect the data field. All annotations, labels, sizes, etcetera, are preserved. In case of dyadic operations the annotation and labels of the first dataset are used for the resulting dataset.

Examples of standard Matlab operations applied to datasets
B = A(:,[3 5]) Construct a new dataset using the features 3 and 5 of A.
A(:,4) = [] Delete feature 4 of A.
B = A(1:10,:) Select the first 10 objects of A.
B = A(A(:,2)>0,:) Select those objects of A for which feature 2 is positive.
C = [A;B]; Add the objects of dataset B to those of A.
and B should have the same number of features.
C = [A B(:,3)] Add feature 3 of B to the features of A.
and B should have the same number of objects.
B = A+7 Add 7 to all elements of A.
B = A+[0 4 6] Add the vector [0 4 6] to all objects of A. A should be a 3-dimensional dataset.
A(:,7) = A(:,7)*5
Multiply feature 7 by 5.
B = A-mean(A) Subtract the mean of all objects from the dataset.
B = A./std(A) Divide for all objects the features by the standard deviation over the dataset.

The following Matlab operators are defined for datasets:

    +, -, *, .*, .^ , /, , ./, |, &, ~, xor, abs, '

In dyadic operations the field settings of the first dataset are copied. Dyadic operations of datasets and double arrays are supported, provided that the dimensions fit. Vectors and scalars used as doubles in dyadic operations with datasets are given the appropriate size using the Matlab repmat command.

The logic operations

     >, >=, <, <=, =, ~=

applied to datasets return logicals as in other, non-PRTools constructs. Monadic operations not overloaded for datasets can be defined by setdata, e.g.:

    B = setdata(A,round(getdata(A)));

which performs the not overloaded operation B = round(A) on a dataset A, or by filtm:

    B = filtm(A,'round')


operations: basic, datasets, datafiles, mappings, classifiers, stacked, parallel, sequential, dyadic
commands: datasets, representation , classifiers, evaluation, clustering and regression, examples, support