Centers data to the centroid of all classes.
- [ccx,mn] = classcentroid(x,options); %calibrate, centers the data
- [ccx,mn,pstd] = classcentroid(x,options); %calibrate, centers and scales
- ccx = classcentroid(x,mn); %apply, centers new data
- ccx = classcentroid(x,mn,pstd); %apply, centers and scales
Rows in the input data are centered to the centroid of all the classes. The centroid is equivalent to a weighted mean where each class is given the same weight. For example, if two classes A and B are present the centroid is
mn = mean([mean(Class A); mean(Class B)]);
If only two outputs are requested, then the data is centered only. If three outputs are requested, than the data is both centered and scaled (scaling based on the pooled standard deviation of the classes). Note that samples belonging to class 0 (unknown class) are not used in calculating the centroid or pooled variance. For more details, see Advanced_Preprocessing:_Variable_Centering.
- x = DataSet object to be class-centered.
- mn = Means from previous call to classcentroid. Must be passed with associated classes (see classset).
- pstd = Pooled standard deviation of the classes. e.g., pstd = mean([std(Class A).^2/MA; std(Class B).^2/MB]); where MA and MB are the number of samples in each class.
options = structure array with the following fields :
- classset = Class set (from rows) which should be used to center data. Default is class set 1.
- offset = scales by pstd = pstd+offset (default = 0).
- ccx = Centered x. Dataset object.
- mn = Row vector of the centroid of the classes.
- pstd = Row vector of pooled standard deviation of the classes.