(i)   Input: : the objects in the training data set (an matrix).
     : the class labels of the training set (an matrix).
     : number of classifiers in the ensemble.
     : number of feature subsets.
     : the set of class labels.
(ii)  Training Phase:
(iii) For     to     do
   (1) Calculate the rotation matrix :
    (a) Randomly split the feature set into subsets .
    (b) For to do
      Let be the data set for the features in .
      Select a bootstrap sample of 75% number of objects in .
      Apply PCA on and store the component coefficients in a matrix .
    (c) Endfor
    (d) Arrange the into a block diagonal matrix .
    (e) Construct by rearranging columns of to match the order of features in .
  (2) Build the classifier using as the training set.
(iv) Endfor
(v)  Output: For a given , calculate its class label assigned by the ensemble classifier :
        ,
where is an indicator function.
Algorithm 2: Rotation forest algorithm.