Trains multiple logistic regression classifiers to handle the multiclass
    problem posed by ``X``

      X (numpy.ndarray): The input data matrix. This must be a numpy.ndarray
        with 3 dimensions or an iterable containing 2 numpy.ndarrays with 2
        dimensions each. Each correspond to the data for one of the input
        classes, every row corresponds to one example of the data set, every
        column, one different feature.


    Returns:

      Machine: A trained multiclass machine.

def train(self, X):
    """
    Trains multiple logistic regression classifiers to handle the multiclass
    problem posed by ``X``

      X (numpy.ndarray): The input data matrix. This must be a numpy.ndarray
        with 3 dimensions or an iterable containing 2 numpy.ndarrays with 2
        dimensions each. Each correspond to the data for one of the input
        classes, every row corresponds to one example of the data set, every
        column, one different feature.


    Returns:

      Machine: A trained multiclass machine.

    """

    _trainer = bob.learn.linear.CGLogRegTrainer(**{'lambda':self.regularizer})

    if len(X) == 2: #trains and returns a single logistic regression classifer

      return _trainer.train(add_bias(X[0]), add_bias(X[1]))

    else: #trains and returns a multi-class logistic regression classifier

      # use one-versus-all strategy
      machines = []
      for k in range(len(X)):
        NC_range = list(range(0,k)) + list(range(k+1,len(X)))
        machines.append(_trainer.train(add_bias(numpy.vstack(X[NC_range])),
            add_bias(X[k])))

      return MultiClassMachine(machines)