def transform(self, X):
X = as_features(X, stack=True, bare=True)<EOL>Y = self.features_<EOL>Ks = np.asarray(self.Ks)<EOL>if X.dim != Y.dim:<EOL><INDENT>msg = "<STR_LIT>"<EOL>raise ValueError(msg.format(Y.dim, X.dim))<EOL><DEDENT>memory = self.memory<EOL>if isinstance(memory, string_types):<EOL><INDENT>memory = Memory(cachedir=memory, verbose=<NUM_LIT:0>)<EOL><DEDENT>est = memory.cache(_est_divs, ignore=['<STR_LIT>', '<STR_LIT>', '<STR_LIT>'])<EOL>output, self.rhos_ = est(<EOL>X, Y, self.indices_, getattr(self, '<STR_LIT>', None),<EOL>self.div_funcs, Ks,<EOL>self.do_sym, self.clamp, self.version, self.min_dist,<EOL>self._flann_args(), self._n_jobs)<EOL>return output<EOL>
r'''
        Computes the divergences from X to :attr:`features_`.

        Parameters
        ----------
        X : list of bag feature arrays or :class:`skl_groups.features.Features`
            The bags to search "from".

        Returns
        -------
        divs : array of shape ``[len(div_funcs), len(Ks), len(X), len(features_)] + ([2] if do_sym else [])``
            The divergences from X to :attr:`features_`.
            ``divs[d, k, i, j]`` is the ``div_funcs[d]`` divergence
            from ``X[i]`` to ``fetaures_[j]`` using a K of ``Ks[k]``.
            If ``do_sym``, ``divs[d, k, i, j, 0]`` is
            :math:`D_{d,k}( X_i \| \texttt{features_}_j)` and
            ``divs[d, k, i, j, 1]`` is :math:`D_{d,k}(\texttt{features_}_j \| X_i)`.