def transform(self, X):
        """
        Transform the given data. Assumes that fit has already been called.
        :param X (DataSet): the data to transform
        """

        extracted = []
        for columns, transformer in self.mapping:
            if transformer is not None:
                feature = transformer.transform(self._get_columns(X, columns))
            else:
                feature = self._get_columns(X, columns)

            if hasattr(feature, 'toarray'):
                # sparse arrays should be converted to regular arrays for hstack.
                feature = feature.toarray()

            if len(feature.shape) == 1:
                feature = np.array([feature]).T
            extracted.append(feature)

        # combine the feature outputs into one array.
        # at this point we lose track of which features
        # were created from which input columns, so it's
        # assumed that that doesn't matter to the model.
        return np.hstack(extracted)